Skip to content

vscode: intelligent live tint for palettes without a bundled theme - #3

Merged
xscriptor merged 1 commit into
mainfrom
vscode-live-tint
Sep 30, 2026
Merged

xscriptor merged 1 commit into
mainfrom
vscode-live-tint

Conversation

@xscriptor

Copy link
Copy Markdown
Member

What

Makes VS Code and VS Code - Insiders follow any palette, including community/ and user-created ones, not only the 12 bundled in xscriptor-themes.

How it works (all dynamic, nothing palette-specific)

  • New themesync/vscode_theme.py: semantic base16 → VS Code mapping. 269 workbench keys (surfaces mixed bg→fg, selection from the accent, terminal ANSI 0-15, git decorations, diff, badges, charts...), 24 TextMate token rules and 20 semantic token rules. Every foreground is WCAG-checked (AA), dark/light is derived from luminance, and optional palette roles (accent, mauve, teal, peach...) refine the accents.
  • vscode target now decides per editor:
    • bundled palette (theme file found by globbing the installed xscriptor.xscriptor-themes-* extension): keep the handcrafted theme + icon theme, and remove the generated block;
    • any other palette: set a coherent base (Default Dark/Light Modern by luminance) and inject a marker-delimited block with workbench.colorCustomizations + editor.tokenColorCustomizations + editor.semanticTokenColorCustomizations. VS Code watches settings.json, so it re-tints live in every window.
  • User-defined customization keys are never overwritten: if one exists outside the block, ours for that key is skipped.
  • Adding themes/icons in the extension later (or renaming palettes) needs no code change: everything is discovered at runtime.

Testing

  • scripts/check.sh: new step validates the mapping for all 137 palettes of the checkout (valid hex colors, WCAG AA contrast on every one; minimum measured 4.53), plus the existing compile/CLI smoke tests.
  • Throwaway HOME end-to-end: dynamic path (valid JSONC, user keys preserved, idempotent), native path (block removed, theme+icons set, idempotent), and light-palette base selection.
  • Real machine: applied for community palette 3024 (Insiders settings got the 269-key block, editor.background #090300), then switched back to x and the file was restored byte-identical to the backup.

@xscriptor
xscriptor merged commit b6691ed into main Sep 30, 2026
2 checks passed
@xscriptor
xscriptor deleted the vscode-live-tint branch September 30, 2026 18:41
- new themesync/vscode_theme.py: base16 -> VS Code mapping (269 workbench
  keys, 24 token rules, 20 semantic rules), WCAG-checked foregrounds,
  dark/light aware, optional palette roles (accent, mauve, teal...)
- vscode target: palettes bundled in xscriptor-themes keep their native
  theme (and the generated block is removed); any other palette gets the
  generated colorCustomizations over a matching Default Dark/Light Modern
  base, applied live by VS Code
- extensions/themes/icons discovered at runtime: no palette list hardcoded
- user-defined customization keys are never overwritten
- scripts/check.sh validates the mapping for every palette (hex + contrast)
- README target table + CHANGELOG entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant