diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-18 22:06:53 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-18 22:06:53 -0500 |
| commit | e110f7afac89322a2af4f3c4ebafe303be044cc2 (patch) | |
| tree | f2b24d43f3c38044bd6127e11be43b157a7db0e5 /scripts/theme-studio/generate.py | |
| parent | 64153c8d995f1603986f3b44ccbdf9ddb21dfd55 (diff) | |
| download | dotemacs-e110f7afac89322a2af4f3c4ebafe303be044cc2.tar.gz dotemacs-e110f7afac89322a2af4f3c4ebafe303be044cc2.zip | |
refactor(theme-studio): cut the face model over to weight/slant/objects
I replaced the legacy bold/italic/underline/strike booleans with the final model shape across both sides of the tool. weight (light/normal/medium/semibold/bold/heavy) and slant (normal/italic/oblique) replace the bold/italic flags, underline becomes {style: line|wave, color}, strike becomes {color}, and null means unset.
A single migration converts a legacy face on the way in, mirrored as migrateLegacyFace in app-core.js and migrate_legacy in face_specs.py so the JS and Python models can't drift. It runs on import (applyImported, mergePackagesInto) and on every seed that face_spec touches. The captured-snapshot seed (default_faces.seed) narrows the same way it did before. Only bold and italic survive, as weight "bold" and slant "italic", so the generated themes stay byte-identical.
The B/I/U/S toggle buttons keep working through a transitional bridge (legacyStyleOn / toggleLegacyStyle). The weight/slant dropdowns and underline/strike controls that replace them land next. The live previews read the new shape, with a weight name mapped to a numeric CSS font-weight.
The cutover is proven emit-neutral two ways. An ERT test asserts the migrated shapes emit the same attributes as the legacy booleans, and deep-migrating every face in dupre, distinguished, sterling, now, theme, and WIP then running build-theme yields byte-identical output. Full suite green: Python 59, Node 200, ERT 41, plus the browser hash gates.
Diffstat (limited to 'scripts/theme-studio/generate.py')
| -rw-r--r-- | scripts/theme-studio/generate.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py index ae31afae2..347a21976 100644 --- a/scripts/theme-studio/generate.py +++ b/scripts/theme-studio/generate.py @@ -2,7 +2,7 @@ import json, os, re from app_inventory import add_inventory_apps, apply_default_face_seeds, apply_package_overrides, face_rows from default_faces import DefaultFaces from face_data import * -from face_specs import face_spec, ui_face_spec +from face_specs import face_spec, ui_face_spec, migrate_legacy HERE=os.path.dirname(os.path.abspath(__file__)) def read_text(name): @@ -100,11 +100,11 @@ def initial_maps(cols,defaults): def apply_builtin_fallback_styles(uimap): """Fill the small set of style defaults used when no Emacs snapshot exists.""" - uimap["link"]["underline"]=True + uimap["link"]["underline"]={"style":"line","color":None} for face in ("lazy-highlight","show-paren-match"): - uimap[face]["underline"]=True + uimap[face]["underline"]={"style":"line","color":None} for face in ("error","warning","success"): - uimap[face]["bold"]=True + uimap[face]["weight"]="bold" for face in ("mode-line","mode-line-inactive"): uimap[face]["box"]={"style":"released","width":1,"color":None} @@ -148,7 +148,7 @@ def apply_seed_basics(data,palette,uimap,locks): palette=data['palette'] if data.get('ui'): for key,value in data['ui'].items(): - uimap[key]=value + uimap[key]=migrate_legacy(value) if 'locks' in data: locks=data['locks'] return palette,uimap,locks |
