From 73544334c9738cae8e3056f182b92e1d9e641f04 Mon Sep 17 00:00:00 2001 From: wagesj45 Date: Sat, 23 Aug 2025 23:51:22 -0500 Subject: [PATCH] build(icons): generate toolbar/add-on PNGs from SVG with transparent background; configurable colors; stop tracking PNGs and ignore outputs --- .gitignore | 5 ++- icons/README.md | 22 ++++------- icons/icon-128.png | Bin 315 -> 0 bytes icons/icon-16.png | Bin 298 -> 0 bytes icons/icon-32.png | Bin 299 -> 0 bytes icons/icon-48.png | Bin 300 -> 0 bytes icons/icon-96.png | Bin 306 -> 0 bytes manifest.json | 2 +- package.json | 3 +- releases/updates.json | 9 +++++ scripts/build-icons.js | 87 +++++++++++++++++++++++++++++++++++++++++ 11 files changed, 111 insertions(+), 17 deletions(-) delete mode 100644 icons/icon-128.png delete mode 100644 icons/icon-16.png delete mode 100644 icons/icon-32.png delete mode 100644 icons/icon-48.png delete mode 100644 icons/icon-96.png create mode 100644 scripts/build-icons.js diff --git a/.gitignore b/.gitignore index fd6a0b3..751d3a0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ node_modules/ # Ignore all release artifacts except updates.json (tracked) releases/* !releases/updates.json - + # Web-ext/AMO signing upload cache (not needed in repo) .amo-upload-uuid + +# Generated icons +icons/icon-*.png diff --git a/icons/README.md b/icons/README.md index e485696..ec0cb99 100644 --- a/icons/README.md +++ b/icons/README.md @@ -1,7 +1,8 @@ Icon assets =========== -Place the final PNGs for the add-on icon here. The manifest is wired to use: +PNG icons are generated from `file-search.svg` during the build. +Run `npm run build` (or `npm run build:icons`) to regenerate. The manifest is wired to use: - Toolbar (browser_action → default_icon): - icons/icon-16.png @@ -13,17 +14,10 @@ Place the final PNGs for the add-on icon here. The manifest is wired to use: Notes ----- -- Use the same artwork at each size; keep transparent backgrounds. -- Source: a 128×128 PNG is perfect; export downscaled versions for 96/48/32/16. +- Source: `icons/file-search.svg` uses `stroke="currentColor"`. +- The build script replaces `currentColor` with configured colors and rasterizes with a transparent background. +- Customize colors via env vars: + - `ICON_COLOR_ADDON` (48/96/128); default `#111827`. + - `ICON_COLOR_TOOLBAR` (16/32); default `#111827`. - Firefox does not require .ico; PNG is recommended. -- If you later want theme-specific toolbar icons, you can add `browser_action.theme_icons` with light/dark variants. - -Quick export (ImageMagick) -------------------------- -```bash -magick file-search.svg -resize 128x128 icon-128.png -magick file-search.svg -resize 96x96 icon-96.png -magick file-search.svg -resize 48x48 icon-48.png -magick file-search.svg -resize 32x32 icon-32.png -magick file-search.svg -resize 16x16 icon-16.png -``` +- Theme variants can be added later via `browser_action.theme_icons`. diff --git a/icons/icon-128.png b/icons/icon-128.png deleted file mode 100644 index 80cd7c24641884aa5063d552e66fee312d7038f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 315 zcmeAS@N?(olHy`uVBq!ia0vp^4Is=2Bp6=1#-sr$g=CK)Uj~LMHK2G41H&(n{0jz# zQUeBtR|yOZRx=nF#0%!^3bX-AFeQ1ryD%``?Gj!Bo>zOmz(` zbd5|x3{0#HO@T<;z`)ADz}%Ga4vL1{{FKbJO57UUGIk~aHE6(XD9OxCEiOsSEx@fu Tuy)3NpdJQKS3j3^P69dd#W95Adh(C|^BYB282KEwgxDpTH+c}l9E`GYL#4+3Zxi}42(>54J>qx zOhODytPD+oNZY``%D}+fl<^LVhTQy=%(P0}8r(8=CIB^Pz-=hW%uOvWNz5(4tw*qS R#(tn422WQ%mvv4FO#nn!On3kQ diff --git a/icons/icon-32.png b/icons/icon-32.png deleted file mode 100644 index ed0a9e44d2794ed02d1367346c2ea080eb0f8712..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 299 zcmeAS@N?(olHy`uVBq!ia0vp^3Lwk~Bp9L@-6KJqWRD z45bDP46hOx7_4S6Fo+k-*%fF5lweBoc6VW5yxS$b1ju7A@$_|Nf5{=i!q4xKQ+pFA z#P8|i7{YNq`3FA>PxEvJhFdS|8>fc^OaV%%mbgZgq$HN4S|t~y0x1R~10z#i0}EXv zlMn+FD??Kt(l#)#GB7YVWxRu;AvZrIGp!Q02Dglz2|x`Ra2rZ8b5n~;5_1c1>k+J- Ru^*_1!PC{xWt~$(698}4N-Zxew=sXGs9%R7+eVN>UO_QmvAUQh^kMk%5t^u7QQF zkx7VwiIt%#5NR72SQ!|Yn=;-((U6;;l9^VCTZ3E1&IF(a4Y&;@nYpROC5gEOxb+Cu S&e#vs!{F)a=d#Wzp$P!{F-k`O diff --git a/icons/icon-96.png b/icons/icon-96.png deleted file mode 100644 index 50b2637be90f7ae90e6b974a6cd228974a887f59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^2_Vb}Bp6OT_L>T$6p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9f$?sa@Dd=8y~NYkmHj1$1PedEM^5cc zppclSi(`nz>Es{%ED~;(i{}KM(@6hOz_8(P_1+-KHZh