Skip to content

Commit cfa5dcf

Browse files
author
dmullis
committed
Add command-line option -hollowcircles; controls drawing of 'o'
If set, the letter 'o' draws a hollow circle, with strokes possibly extending into it; otherwise, the circle is filled with a computed inverse of the foreground drawing color.
1 parent 3d541a7 commit cfa5dcf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cmd/goat/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ func main() {
3636
3737
See https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
3838
`)
39+
flag.BoolVar(&goat.HollowCircles, "hollowcircles", false,
40+
`If set, the letter 'o' draws a hollow circle, with strokes possibly extending
41+
into it; otherwise, the circle is filled with a computed inverse of the foreground
42+
drawing color.`)
3943
flag.Parse()
4044

4145
format = strings.ToLower(format)

svg.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"io"
77
)
88

9+
var HollowCircles bool
10+
911
type SVG struct {
1012
Body string
1113
Width int
@@ -260,12 +262,15 @@ func (t Triangle) Draw(out io.Writer) {
260262

261263
// Draw a solid circle as an SVG circle element.
262264
func (c *Circle) Draw(out io.Writer) {
263-
fill := "none"
264-
265+
var fill string
265266
if c.bold {
266267
fill = "currentColor"
268+
} else {
269+
fill = "invert(currentColor)"
270+
if HollowCircles {
271+
fill = "none"
272+
}
267273
}
268-
269274
pixel := c.start.asPixel()
270275

271276
writeBytes(out,

0 commit comments

Comments
 (0)