diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-08 02:56:39 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-08 02:56:39 -0500 |
| commit | f06b93b49c4543cb8dfc3d290d37beeac6653208 (patch) | |
| tree | 5114313497797dbf3b6e8a4ee133b68a04950a3d /scripts/theme-selector/README.md | |
| parent | 13e703902d76e7f3593d046e2b892084a365fe8a (diff) | |
| download | dotemacs-f06b93b49c4543cb8dfc3d290d37beeac6653208.tar.gz dotemacs-f06b93b49c4543cb8dfc3d290d37beeac6653208.zip | |
feat(theme-selector): convert theme.json into a loadable deftheme
build-theme.el is the last link in the theme-selector pipeline: a theme.json export becomes a single self-contained themes/<name>-theme.el. All four tiers convert: default from assignments.bg/.p, the syntax categories to their font-lock/tree-sitter faces with the bold/italic sets applied, UI passthrough, and package faces with :inherit/:height/weight/slant.
The output is a flat generated deftheme, not the palette/faces/theme trio the hand-authored dupre ships. A theme.json carries resolved per-face hex, not dupre's semantic-mapping layer, so a flat deftheme is the faithful output and never clobbers the curated dupre files.
I omitted the dec (decorator) key: Emacs has no dedicated decorator face and renders decorators with font-lock-type-face, which the type key already owns, so coloring dec independently would clobber types. Decorators follow the type color, as they do in stock Emacs.
20 ERT tests cover the attribute builder, each tier, the dec omission, and an end-to-end convert-and-load with a WCAG-AA assertion on the round-tripped default.
Diffstat (limited to 'scripts/theme-selector/README.md')
| -rw-r--r-- | scripts/theme-selector/README.md | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/scripts/theme-selector/README.md b/scripts/theme-selector/README.md index 5ed49c14..ca708c51 100644 --- a/scripts/theme-selector/README.md +++ b/scripts/theme-selector/README.md @@ -125,10 +125,28 @@ The export (and what a build step consumes): `export` always downloads a fresh file; `save` (shown once a name is entered) writes the same file in place via the File System Access API. -## Next step (not yet built) +## Build step — `build-theme.el` -A `theme.json` → `themes/<name>-palette.el` + `-faces.el` + `-theme.el` -converter, in Elisp. That step is the correctness-sensitive part and the one -worth TDD: JSON in, valid Emacs palette + faces out, every face (syntax, UI, and -package) mapped, `:inherit`/`:height` written correctly, and WCAG-contrast -asserted on the result. +`build-theme.el` converts a `theme.json` into a single self-contained +`themes/<name>-theme.el` deftheme. JSON in, valid Emacs faces out, across all +four tiers: `default` from `assignments.bg`/`.p`, the syntax categories mapped +to their font-lock / tree-sitter faces (with the `bold`/`italic` sets applied), +the UI faces passed through, and the package faces with `:inherit`/`:height` +and weight/slant written. + +```bash +emacs --batch -l scripts/theme-selector/build-theme.el \ + --eval '(build-theme/convert-file "scripts/theme-selector/dupre-revised.json" "themes")' +``` + +Output is a flat generated deftheme, not the palette/faces/theme trio the +original dupre ships — a `theme.json` carries resolved per-face hex, not dupre's +semantic-mapping layer, so a flat deftheme is the faithful output and never +clobbers the curated dupre files. + +One mapping limitation: the `dec` (decorator) syntax key has no independent +Emacs face. Emacs renders decorators with `font-lock-type-face`, which the `ty` +key already owns, so `dec` is omitted from the output and decorators follow the +type color (as they do in stock Emacs). Tests live in +`tests/test-build-theme.el` (Normal / Boundary / Error, plus a WCAG-contrast +assertion on the round-tripped result). |
