diff --git a/cmd/mark/main.go b/cmd/mark/main.go index 813bfc3..5c80396 100644 --- a/cmd/mark/main.go +++ b/cmd/mark/main.go @@ -76,9 +76,15 @@ func run() error { return fmt.Errorf("%s: %w", *src, err) } + onNavy := shadowOn(drawing, stack, navy) + var stale []string for name, l := range sizes { - img, err := cut(drawing, stack, l.size, l.clear, navy) + src := onNavy + if l.clear { + src = drawing + } + img, err := cut(src, stack, l.size, l.clear, navy) if err != nil { return fmt.Errorf("%s: %w", name, err) } @@ -142,6 +148,29 @@ func stackOf(drawing image.Image) (image.Rectangle, error) { return box, nil } +// shadowOn is the drawing for the tile: its shadow is a light grey ring, drawn for a light ground, +// which on the navy reads as a halo; a shadow is never lighter than what it falls on. The ring is +// the grey in the stack's bottom quarter - the white top disk is grey too, but at the top - and +// becomes the navy with a sixteenth of the ring's light in it, a rim as the avatar's was. +func shadowOn(drawing image.Image, stack image.Rectangle, navy color.RGBA) image.Image { + const light = 0.06 + out := image.NewNRGBA(drawing.Bounds()) + draw.Draw(out, out.Bounds(), drawing, drawing.Bounds().Min, draw.Src) + band := stack.Min.Y + stack.Dy()*3/4 + for y := band; y < stack.Max.Y; y++ { + for x := stack.Min.X; x < stack.Max.X; x++ { + c := out.NRGBAAt(x, y) + hi, lo := max(c.R, c.G, c.B), min(c.R, c.G, c.B) + if c.A == 0 || hi-lo > 24 || hi < 96 { + continue + } + mix := func(n, g uint8) uint8 { return uint8(float64(n) + light*(float64(g)-float64(n)) + 0.5) } + out.SetNRGBA(x, y, color.NRGBA{mix(navy.R, c.R), mix(navy.G, c.G), mix(navy.B, c.B), c.A}) + } + } + return out +} + // cut is the stack centered on a square of size pixels, a fifth of its size around it, on the // navy or on nothing. func cut(drawing image.Image, stack image.Rectangle, size int, clear bool, navy color.RGBA) (*image.RGBA, error) { diff --git a/logos/apple-touch-icon.png b/logos/apple-touch-icon.png index ca0a75b..22124a5 100644 Binary files a/logos/apple-touch-icon.png and b/logos/apple-touch-icon.png differ diff --git a/logos/favicon-32.png b/logos/favicon-32.png index 02439bd..1c4449b 100644 Binary files a/logos/favicon-32.png and b/logos/favicon-32.png differ diff --git a/logos/favicon-64.png b/logos/favicon-64.png index ed3bcd8..43841e3 100644 Binary files a/logos/favicon-64.png and b/logos/favicon-64.png differ diff --git a/logos/mark-256.png b/logos/mark-256.png index c2ffaac..e74d626 100644 Binary files a/logos/mark-256.png and b/logos/mark-256.png differ diff --git a/logos/mark-512.png b/logos/mark-512.png index e4a44d1..487f6fd 100644 Binary files a/logos/mark-512.png and b/logos/mark-512.png differ