From 572789dd18991b37ff1884f52ea3a2202a3be2b9 Mon Sep 17 00:00:00 2001 From: Cliff Brake Date: Tue, 1 Sep 2026 09:46:41 -0400 Subject: [PATCH] add favicon --- CLAUDE.md | 7 ++--- favicon.png | Bin 0 -> 1184 bytes gitplm-icon.svg | 7 +++++ kicad_api.go | 4 +-- scripts/gen-logo.py | 62 ++++++++++++++++++++++++++++++-------------- 5 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 favicon.png create mode 100644 gitplm-icon.svg diff --git a/CLAUDE.md b/CLAUDE.md index 265cf0c..6f52b01 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -147,6 +147,7 @@ than matching the format again elsewhere. - File search uses `fs.WalkDir` from `./` and does NOT follow symlinks - Hooks use `/bin/sh -c` (Linux/macOS only) - `gocsv` library handles CSV marshal/unmarshal via struct tags -- `scripts/gen-logo.py` regenerates `gitplm-logo.svg` and - `gitplm-logo-square.svg` from Fira Code glyph outlines (fontTools); its - docstring has the `rsvg-convert` commands for the PNG derivatives +- `scripts/gen-logo.py` regenerates `gitplm-logo.svg`, `gitplm-logo-square.svg`, + and the `[g]` favicon source `gitplm-icon.svg` from Fira Code glyph outlines + (fontTools); its docstring has the `rsvg-convert` commands for the PNG + derivatives, including `favicon.png` diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..789a06ff70b11ebc064bfd23928b057676d567ba GIT binary patch literal 1184 zcmV;R1Yi4!P)00006VoOIv0RI60 z0RN!9r;`8x1XW2yK~!jg?U-9=990;{znL>TGkeSIB}=+7SCVwMND!$Bd&hP1*`Obdd_uq5oeCG@Rg+ifFC=?2XLfIyauYqHdZzerW+N8F8 zYngZ|kwX!2pXg~SUn=7U_B3&R?iilwz0m7vDqSq?hJfVpWc#UhPgCXVik|?Mcpi@! z-x+A8{8d?-)ZFgM?<>2JihNbp|JL2ExKB);@Lt2sv?M^eqA1st?Wfin)$7&j^{U&A z9f`Ff;D5h_sDQ1*@C@I@lk)cH1TcsRJrzoyO%LB0?)s#Ql-rhG;;n+(ko2-7X2igr z0E#0NM@T~Aporqg86X{&*dS}y?VZOWEPxHN>9gsMcRCosx5i@=Yg3vqAk_b??>r(& z0j$Ul{Wugk6mh!P!sd*LVhF_$05mF%!kL14Q#BV&tb3Q$?F1#|2mm_Ice>fnpP$b~ zbL0Kvxp;2sxhZqO;X=Qm0c+TOCv9KAdxxxH_iJzCY_k>-nN5 z&=DXN6bK3s_6lrd)thp4ec7&#t(I6e$Vx9sq=EuL0bFwJb!wCw>#Ww2<+cOq|Ktpq zv!>hLc&rzP)}9!%2C1MxP(Xd6uKl%oVokl3YMu}P=yh0K=uY?CtD>&mU-$8cLwV>xtNrm@{he!lF?iIRhl?K=np7e>mTFsgLjBg(0E) zv+i{RD&JNL?-mF~1mcyrvCsev0AR@$8)2CM0|3^NrQTG_UzT^{QbAGx!!ZM+1AH%! zEj;nWgjqD%FpG6;uMjx%_(4)Y_&`_~6ac`k*^N>I8`v_eO@FmRND6TOY1D?Yzhu>) zRlBzO#9p?I`$qMrYV&SO1d;;kAJayk23Hu!iD06fog zv7@o@fwd^key}Mm35dTMZ|;^ZmNp9L|E6EehyXBmZf@!OrHxK(&93L_jsQ05v2>*u zCBILL4}si$KtiGYq0s(N;#k6S0N>3=pN~52`X2-?lMcQ!fOVXIA@6DOJWeXt6lY;1 zjwjd%tBfkfeZ#6+s10%LT;yOR{#x9<$`n5?ZuC(6v?!0re#!Xd>3j9wDytXbXCj-7 zv!U=oq4<%9fbD@uIl>JrkH~h-7Waxs@^EX(mi(Q3_r%?e_qClsYzCU)yLmAqA_=i= ytX;G1nypP~#vQ}&8$X3Yp-?Ck3WY-XSNI2^p^VQf?s$#>0000 + + + + + + diff --git a/kicad_api.go b/kicad_api.go index 9926332..469a747 100644 --- a/kicad_api.go +++ b/kicad_api.go @@ -267,7 +267,7 @@ func (s *KiCadServer) getCategoryDisplayName(category string) string { "RES": "Resistors", "RFM": "RF Modules", "SWI": "Switches", - "XTR": "Transceivers", + "XTR": "Transistors/FETs", "LED": "LEDs", "SCR": "Screws", "MCH": "Mechanical", @@ -321,7 +321,7 @@ func (s *KiCadServer) getCategoryDescription(category string) string { "RES": "Resistor components", "RFM": "RF module components", "SWI": "Switch components", - "XTR": "Transceiver components", + "XTR": "Transistor and FET components", "LED": "Light emitting diode components", "SCR": "Screw and fastener components", "MCH": "Mechanical components", diff --git a/scripts/gen-logo.py b/scripts/gen-logo.py index fd9dd16..d7fb76a 100644 --- a/scripts/gen-logo.py +++ b/scripts/gen-logo.py @@ -4,10 +4,16 @@ SVG) using Fira Code Medium, in phosphor green on black like a classic CRT terminal. +Outputs: + gitplm-logo.svg wide wordmark (README header) + gitplm-logo-square.svg square wordmark (og:image / social previews) + gitplm-icon.svg square [g] icon (favicons, small sizes) + Usage: python scripts/gen-logo.py rsvg-convert -w 400 gitplm-logo.svg -o gitplm-logo.png rsvg-convert -w 360 -h 360 gitplm-logo-square.svg -o gitplm-logo-square.png + rsvg-convert -w 64 -h 64 gitplm-icon.svg -o favicon.png Requires fontTools and the Fira Code font (path below). """ @@ -30,22 +36,22 @@ cmap = font.getBestCmap() glyphs = font.getGlyphSet() -# Build one combined path, y-flipped (font coords -> SVG coords), advancing x. -pen = SVGPathPen(glyphs) -bpen = BoundsPen(glyphs) -x = 0 -for ch in TEXT: - g = glyphs[cmap[ord(ch)]] - t = Transform(1, 0, 0, -1, x, 0) - g.draw(TransformPen(pen, t)) - g.draw(TransformPen(bpen, t)) - x += g.width -path = pen.getCommands() -xmin, ymin, xmax, ymax = bpen.bounds -w, h = xmax - xmin, ymax - ymin +def text_path(text): + """Combined outline path, y-flipped (font coords -> SVG coords), plus bounds.""" + pen = SVGPathPen(glyphs) + bpen = BoundsPen(glyphs) + x = 0 + for ch in text: + g = glyphs[cmap[ord(ch)]] + t = Transform(1, 0, 0, -1, x, 0) + g.draw(TransformPen(pen, t)) + g.draw(TransformPen(bpen, t)) + x += g.width + return pen.getCommands(), bpen.bounds -def svg(width, height, scale, tx, ty): + +def svg(path, width, height, scale, tx, ty): return f""" @@ -56,19 +62,35 @@ def svg(width, height, scale, tx, ty): """ +def square(path, bounds, frac): + """360x360 square with the text scaled to frac of the width, centered.""" + xmin, ymin, xmax, ymax = bounds + w, h = xmax - xmin, ymax - ymin + SQ = 360 + s = (SQ * frac) / w + tx = (SQ - w * s) / 2 - xmin * s + ty = (SQ - h * s) / 2 - ymin * s + return svg(path, SQ, SQ, s, tx, ty) + + +path, bounds = text_path(TEXT) +xmin, ymin, xmax, ymax = bounds +w, h = xmax - xmin, ymax - ymin + # Wide wordmark, normalized to 100 px tall. pad = 0.30 * h s = 100.0 / (h + 2 * pad) W = round((w + 2 * pad) * s, 2) (ROOT / "gitplm-logo.svg").write_text( - svg(W, 100, s, (pad - xmin) * s, (pad - ymin) * s) + svg(path, W, 100, s, (pad - xmin) * s, (pad - ymin) * s) ) print(f"wrote gitplm-logo.svg {W} x 100") # Square logo: 360x360, text ~85% of width, centered. -SQ = 360 -s2 = (SQ * 0.85) / w -tx = (SQ - w * s2) / 2 - xmin * s2 -ty = (SQ - h * s2) / 2 - ymin * s2 -(ROOT / "gitplm-logo-square.svg").write_text(svg(SQ, SQ, s2, tx, ty)) +(ROOT / "gitplm-logo-square.svg").write_text(square(path, bounds, 0.85)) print("wrote gitplm-logo-square.svg 360x360") + +# [g] icon for favicons -- a full wordmark is unreadable at tab size. +ipath, ibounds = text_path("[g]") +(ROOT / "gitplm-icon.svg").write_text(square(ipath, ibounds, 0.72)) +print("wrote gitplm-icon.svg 360x360")