package graph import ( "fmt" "io" "os" "edge-infra.dev/pkg/lib/text/drawing" ) func dotNodeByType(ref string, mediaType string) (*drawing.DotNode, error) { var shape string var color string switch mediaType { case idxNode: shape = "folder" color = `"#90a188"` case imgNode: shape = "box3d" color = `"#e895cb"` case layerNode: shape = "note" color = `"#dbe4f1"` case objectsNode: shape = "component" color = "invis" default: return nil, errUnsupportedDotNodeType } return &drawing.DotNode{ Data: ref, Attributes: map[string]string{ "shape": shape, "fillcolor": color, "style": "filled", }, }, nil } type palletLegend struct{} func (l *palletLegend) Print() { l.Fprint(os.Stdout) } func (l *palletLegend) Fprint(w io.Writer) { legend := `subgraph cluster_legend { style=dotted Index [shape=folder fillcolor="#90a188" style=filled] Image [shape=box3d fillcolor="#e895cb" style=filled] Layer [shape=note fillcolor="#dbe4f1" style=filled] Objects [shape=component fillcolor=invis style=filled] Index -> Image -> Layer -> Objects [style="invis"] }` fmt.Fprintln(w, legend) }