Highlight root people
2 files changed, 28 insertions(+), 20 deletions(-)

M cmd/orgchart/main.go
M cmd/orgchart/svg.go
M cmd/orgchart/main.go +12 -11
@@ 1,7 1,6 @@ 
 package main
 
 // TODO: Report-to (e.g., show anchor person's superior)
-// TODO: Highlight filtered person boxes
 // TODO: Support for ordering
 // TODO: Max-depth (e.g., show only X levels below anchor person)
 // TODO: Dotted lines

          
@@ 20,16 19,18 @@ import (
  *  Constants & global variables                                          *
  **************************************************************************/
 const (
-	boxW     = 190
-	gapW     = 30
-	marginW  = 20
-	gapH     = 100
-	marginH  = 20
-	textPX   = 5
-	textPY   = 5
-	textSize = 12
-	_id      = "person"
-	_ref     = "#person"
+	boxW      = 190
+	gapW      = 30
+	marginW   = 20
+	gapH      = 100
+	marginH   = 20
+	textPX    = 5
+	textPY    = 5
+	textSize  = 12
+	_id       = "person"
+	_ref      = "#person"
+	_root_id  = "root"
+	_root_ref = "#root"
 )
 
 var boxH int

          
M cmd/orgchart/svg.go +16 -9
@@ 42,13 42,16 @@ func renderSVG(out io.Writer, rs Ranks) 
 	c.Gid(_id)
 	c.Rect(0, 0, boxW, boxH, "fill: inherit; stroke: black; stroke-width: 1;")
 	c.Gend()
+	c.Gid(_root_id)
+	c.Rect(0, 0, boxW, boxH, "fill: inherit; stroke: black; stroke-width: 3;")
+	c.Gend()
 	c.DefEnd()
 	defer c.End()
 
 	b := make(map[string]Box)
 	xoff := marginW
 	for _, p := range rs[0] {
-		drawOrg(c, xoff, marginH/2, p, b, false)
+		drawOrg(c, xoff, marginH/2, p, b, true, false)
 		xoff += p.Width()
 	}
 	for _, r := range rs {

          
@@ 56,8 59,8 @@ func renderSVG(out io.Writer, rs Ranks) 
 	}
 }
 
-func drawOrg(canvas *svg.SVG, xoffset, yoffset int, p *Person, boxes map[string]Box, leaf bool) {
-	drawPerson(canvas, xoffset, yoffset, p.Index(), p, boxes, leaf)
+func drawOrg(canvas *svg.SVG, xoffset, yoffset int, p *Person, boxes map[string]Box, root, leaf bool) {
+	drawPerson(canvas, xoffset, yoffset, p.Index(), p, boxes, root, leaf)
 	if len(p.Reports) > 0 {
 		isLeaf := true
 		for _, report := range p.Reports {

          
@@ 65,7 68,7 @@ func drawOrg(canvas *svg.SVG, xoffset, y
 		}
 		yoffset += boxH + (gapH / 2)
 		for _, q := range p.Reports {
-			drawOrg(canvas, xoffset, yoffset, q, boxes, isLeaf)
+			drawOrg(canvas, xoffset, yoffset, q, boxes, false, isLeaf)
 			if isLeaf {
 				yoffset += boxH + (gapH / 2)
 			} else {

          
@@ 75,21 78,25 @@ func drawOrg(canvas *svg.SVG, xoffset, y
 	}
 }
 
-func drawPerson(canvas *svg.SVG, x, y, ind int, person *Person, boxes map[string]Box, leaf bool) {
+func drawPerson(canvas *svg.SVG, x, y, ind int, person *Person, boxes map[string]Box, root, leaf bool) {
 	if !leaf {
 		x += (person.Width() - (boxW + (gapH / 2))) / 2
 	}
-	drawBox(canvas, x, y, person)
+	drawBox(canvas, x, y, person, root)
 	boxes[person.Name] = Box{X: x, Y: y, Leaf: leaf}
 }
 
-func drawBox(c *svg.SVG, x, y int, p *Person) {
-	c.Use(x+2, y+3, _ref, `filter="url(#blur)"`)
+func drawBox(c *svg.SVG, x, y int, p *Person, root bool) {
+	ref := _ref
+	if root {
+		ref = _root_ref
+	}
+	c.Use(x+2, y+3, ref, `filter="url(#blur)"`)
 	fill := "fill: white"
 	if p.Contractor {
 		fill = "fill: yellow"
 	}
-	c.Use(x, y, _ref, fill)
+	c.Use(x, y, ref, fill)
 	toff := x + (boxW / 2)
 	toffY := y + textSize + textPY
 	if p.Title != "" {