Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview: fix dolly favicon prefers-color-scheme

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.org>

author
Anirudh Oppiliappan
committer
Tangled
date (Jun 10, 2026, 5:28 PM +0300) commit a5d661f5 parent 9da42287 change-id mtlopxxp
+31 -7
+1 -1
.tangled/workflows/deploy-blog.yml
··· 23 23 command: | 24 24 ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.png -size 180x180 25 25 ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.ico -size 48x48 26 - ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.svg -color currentColor 26 + ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.svg -color currentColor -favicon 27 27 28 28 - name: generate css 29 29 command: |
+4 -1
appview/pages/pages.go
··· 298 298 type DollyParams struct { 299 299 Classes string 300 300 FillColor string 301 + // Favicon embeds a prefers-color-scheme style block so the SVG 302 + // adapts to dark mode when used as a standalone favicon document. 303 + Favicon bool 301 304 } 302 305 303 306 func (p *Pages) Dolly(w io.Writer, params DollyParams) error { ··· 306 309 307 310 func (p *Pages) Favicon(w io.Writer) error { 308 311 return p.Dolly(w, DollyParams{ 309 - Classes: "text-black dark:text-white", 312 + Favicon: true, 310 313 }) 311 314 } 312 315
+13
appview/pages/templates/fragments/dolly/logo.html
··· 4 4 viewBox="0 0 32 32" 5 5 fill="{{ or .FillColor "currentColor" }}" 6 6 xmlns="http://www.w3.org/2000/svg"> 7 + {{ if .Favicon }} 8 + <style> 9 + :root { 10 + color: #000000; 11 + } 12 + 13 + @media (prefers-color-scheme: dark) { 14 + :root { 15 + color: #ffffff; 16 + } 17 + } 18 + </style> 19 + {{ end }} 7 20 <path d="M21.0971 30.866C20.0566 30.8575 19.2628 30.5542 18.4016 30.0269C17.1668 29.3753 16.2237 28.2808 15.5497 27.0739C14.4789 28.4065 13.0476 29.215 11.4453 29.6718C10.763 29.8705 9.56809 30.0721 7.58737 29.3523C4.73277 28.3905 2.65342 25.4114 2.88973 22.3758C2.8465 21.1175 3.30392 19.8825 3.95228 18.8208C2.22264 17.8897 0.81225 16.3266 0.272148 14.4098C-0.0560731 13.3604 -0.042271 12.2299 0.0787626 11.1512C0.512215 8.60429 2.41697 6.38956 4.86912 5.59294C5.8479 3.35574 7.98378 1.68743 10.4037 1.34778C12.0104 1.12338 13.6735 1.46075 15.0792 2.27979C17.1272 0.00158595 20.6952 -0.671697 23.4195 0.727793C25.4978 1.72322 26.9839 3.80003 27.3447 6.06471C29.3222 6.85928 30.9877 8.47971 31.6413 10.5368C32.0784 11.8104 32.0928 13.2132 31.8098 14.5209C31.3041 16.5615 29.8679 18.2987 28.009 19.2482C28.0135 19.6113 29.2037 22.2296 29.0047 24.2056C28.9612 26.676 27.399 29.0172 25.2325 30.1544C23.9683 30.8945 22.4702 30.8805 21.0971 30.866ZM15.1733 23.755C16.9256 23.5593 18.0743 22.0269 18.9665 20.6469C19.3883 20.0182 19.7105 19.3146 20.0306 18.6454C20.4458 19.0271 20.7975 19.7461 21.4541 19.9173C22.1457 20.1333 22.9566 19.9579 23.38 19.3277C24.1902 17.8118 23.7908 15.9827 23.319 14.4119C23.0284 13.5097 22.6472 12.5841 21.9218 11.9446C22.0765 10.85 21.4299 9.73834 20.5106 9.16542C19.7272 9.79198 18.5352 9.78821 17.7794 9.11795C16.3309 10.5997 15.0034 10.5505 13.7212 9.37618C13.4331 9.11226 12.8832 10.9871 10.9535 9.92506C9.84488 10.8567 8.98526 11.753 8.22356 13.0435C7.48342 14.4347 6.70829 15.6703 6.64151 17.1811C6.6094 18.0641 7.29731 18.9892 8.22942 18.9174C9.16105 19.0009 9.7952 18.0813 10.5006 17.6993C10.6058 18.9316 10.7243 20.2556 11.1395 21.4587C11.6161 23.0155 13.2947 24.005 14.8835 23.7784C14.9959 23.7696 15.1733 23.7549 15.1733 23.755ZM16.0828 19.1062C15.2306 18.5823 15.6407 17.4452 15.6066 16.6193C15.6914 15.6227 15.7594 14.575 16.2061 13.667C16.6788 13.0197 17.8318 13.2694 17.8827 14.0999C17.8488 14.9353 17.4664 15.767 17.5121 16.633C17.4129 17.3561 17.5839 18.1684 17.265 18.8293C17.0033 19.195 16.4703 19.3013 16.0828 19.1062ZM12.3606 18.6302C11.5578 18.1933 11.8129 17.0941 11.687 16.3298C11.7914 15.445 11.7045 14.3226 12.4431 13.7021C13.1653 13.1969 14.1485 14.0621 13.8069 14.8564C13.4426 15.8602 13.6814 16.957 13.6891 17.9748C13.5512 18.5752 12.911 18.894 12.3606 18.6302Z" fill="{{ or .FillColor "currentColor" }}"/> 8 21 </svg> 9 22 {{ end }}
+10 -2
cmd/dolly/main.go
··· 26 26 fillColor string 27 27 output string 28 28 templatePath string 29 + favicon bool 29 30 ) 30 31 31 32 flag.StringVar(&templatePath, "template", "", "Path to dolly go-html template") 32 33 flag.StringVar(&size, "size", "512x512", "Output size in format WIDTHxHEIGHT (e.g., 512x512)") 33 34 flag.StringVar(&fillColor, "color", "#000000", "Fill color in hex format (e.g., #FF5733)") 34 35 flag.StringVar(&output, "output", "dolly.svg", "Output file path (format detected from extension: .svg, .png, or .ico)") 36 + flag.BoolVar(&favicon, "favicon", false, "Embed a prefers-color-scheme style block so the SVG reacts to dark mode (SVG output only)") 35 37 flag.Parse() 36 38 37 39 if templatePath == "" { ··· 65 67 os.Exit(1) 66 68 } 67 69 68 - svgData, err := dolly(string(tpl), fillColor) 70 + if favicon && format != "svg" { 71 + fmt.Fprintf(os.Stderr, "-favicon is only supported for .svg output\n") 72 + os.Exit(1) 73 + } 74 + 75 + svgData, err := dolly(string(tpl), fillColor, favicon) 69 76 if err != nil { 70 77 fmt.Fprintf(os.Stderr, "Error generating SVG: %v\n", err) 71 78 os.Exit(1) ··· 97 104 fmt.Printf("Successfully generated %s (%dx%d)\n", output, width, height) 98 105 } 99 106 100 - func dolly(tplString, hexColor string) ([]byte, error) { 107 + func dolly(tplString, hexColor string, favicon bool) ([]byte, error) { 101 108 tpl, err := template.New("dolly").Parse(tplString) 102 109 if err != nil { 103 110 return nil, err ··· 107 114 if err := tpl.ExecuteTemplate(&svgData, "fragments/dolly/logo", map[string]any{ 108 115 "FillColor": hexColor, 109 116 "Classes": "", 117 + "Favicon": favicon, 110 118 }); err != nil { 111 119 return nil, err 112 120 }
+1 -1
localinfra/scripts/appview-static-files.sh
··· 41 41 TEMPLATE="$REPO_ROOT/appview/pages/templates/fragments/dolly/logo.html" 42 42 "$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.png" -size 180x180 43 43 "$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.ico" -size 48x48 44 - "$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.svg" -color currentColor 44 + "$TMP/dolly" -template "$TEMPLATE" -output "$OUT/logos/dolly.svg" -color currentColor -favicon
+1 -1
nix/pkgs/appview-static-files.nix
··· 32 32 33 33 ${dolly}/bin/dolly -output logos/dolly.png -size 180x180 34 34 ${dolly}/bin/dolly -output logos/dolly.ico -size 48x48 35 - ${dolly}/bin/dolly -output logos/dolly.svg -color currentColor 35 + ${dolly}/bin/dolly -output logos/dolly.svg -color currentColor -favicon 36 36 # tailwindcss -c $src/tailwind.config.js -i $src/input.css -o tw.css won't work 37 37 # for whatever reason (produces broken css), so we are doing this instead 38 38 cd ${src} && ${tailwindcss}/bin/tailwindcss -i input.css -o $out/tw.css
+1 -1
nix/pkgs/docs.nix
··· 56 56 # favicons 57 57 ${dolly}/bin/dolly -output $out/static/logos/dolly.png -size 180x180 58 58 ${dolly}/bin/dolly -output $out/static/logos/dolly.ico -size 48x48 59 - ${dolly}/bin/dolly -output $out/static/logos/dolly.svg -color currentColor 59 + ${dolly}/bin/dolly -output $out/static/logos/dolly.svg -color currentColor -favicon 60 60 61 61 # styles 62 62 cd ${src} && ${tailwindcss}/bin/tailwindcss -i input.css -o $out/stylesheet.css