diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-24 05:46:43 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-24 05:46:43 -0400 |
| commit | 5e72000497732e7d20c179d2562e4bfacc1e3fbe (patch) | |
| tree | 7731134bf5d36359543cc407fddfbcbc30dc12df /scripts/theme-studio/app_inventory.py | |
| parent | a98dc772708f33e90aaeb4572a13bf22d065a022 (diff) | |
| download | dotemacs-5e72000497732e7d20c179d2562e4bfacc1e3fbe.tar.gz dotemacs-5e72000497732e7d20c179d2562e4bfacc1e3fbe.zip | |
feat(theme-studio): bespoke nerd-icons filetype-legend preview (phase 2)
Register nerd-icons as a bespoke app whenever its captured legend is valid: the 34 color faces stay editable rows, and the legend rides APPS['nerd-icons'].legend. A new renderNerdIconsPreview draws each curated filetype's glyph in its mapped face's effective color, read through the same registry the other previews use, so recoloring a face repaints every row mapped to it. When the legend is absent the generic inventory app stands in. The #nerdiconstest browser gate covers the wiring, the dir-row owner, and the recolor-repaint.
Claude-Session: https://claude.ai/code/session_01BqrdWUo9GcznYX2pZr76gZ
Diffstat (limited to 'scripts/theme-studio/app_inventory.py')
| -rw-r--r-- | scripts/theme-studio/app_inventory.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/theme-studio/app_inventory.py b/scripts/theme-studio/app_inventory.py index 11ca605d1..09e2ed0a0 100644 --- a/scripts/theme-studio/app_inventory.py +++ b/scripts/theme-studio/app_inventory.py @@ -50,6 +50,31 @@ def add_inventory_apps(apps: dict[str, Any], inventory_path: str) -> dict[str, A return apps +def add_nerd_icons_app(apps: dict[str, Any], inventory_path: str, legend: Any) -> dict[str, Any]: + """Register nerd-icons as a bespoke legend app from its inventory faces. + + The 34 nerd-icons color faces stay editable rows; LEGEND (the validated rows + from generate.load_nerd_icons_legend) rides the app so the bespoke previews.js + renderer can draw each filetype glyph in its mapped face color. A no-op when + LEGEND is falsy or the inventory lacks nerd-icons -- the caller guards on a + valid legend, and add_inventory_apps then creates the generic fallback app. + Must run before add_inventory_apps so the generic path skips nerd-icons. + """ + if not legend or not os.path.exists(inventory_path): + return apps + with open(inventory_path) as src: + faces = json.load(src).get("nerd-icons") + if not faces: + return apps + apps["nerd-icons"] = { + "label": "nerd-icons", + "preview": "nerdicons", + "faces": [[face, face_label(face, "nerd-icons-"), {}] for face in faces], + "legend": legend, + } + return apps + + def apply_default_face_seeds(apps: dict[str, Any], defaults: Any) -> None: if not defaults.available: return |
