Pre
A dark theme for VS Code. Neon accents on a neutral grey ramp, with every text pairing
measured against WCAG AA.
Install
Search for Pre in the Extensions view, or run:
code --install-extension leandromatos.pre
How the theme is built
themes/Pre-color-theme.json is generated. Do not edit it. Every colour is decided in
src/palette.ts, by role, and the rest of src/ maps those roles onto VS Code:
| File |
What it decides |
src/palette.ts |
The palette. Surfaces, the text ramp, the accents, the syntax roles. |
src/colors.ts |
The workbench, grouped the way the interface is. |
src/tokens.ts |
TextMate rules, one per syntax role. |
src/color.ts |
OKLCH resolution, alpha, mixing, contrast. |
src/audit.ts |
The checks, run against the colour registry of the installed VS Code. |
bun run build # write themes/Pre-color-theme.json
bun run watch # rebuild on save; VS Code reloads the theme with no window reload
bun run audit # build, then check the result
bun run registry # re-read the colour registry after a VS Code upgrade
What the audit checks
src/registry.json holds every colour id the installed VS Code registers, which of them
must be transparent, and which are deprecated. scripts/extract-registry.ts reads it out
of the shipped bundle and the built-in extension manifests, so the list matches the editor
you are running rather than a documentation page. The published reference is behind: it
still lists testing.message.error.decorationForeground, which 1.136 renamed.
The audit fails on a key VS Code no longer accepts, a deprecated key, an opaque colour on a
key that paints over the code, and a value that is not a hex colour. Contrast is reported
rather than gated, because closing a shortfall means changing a colour and that is a
decision about how the theme looks: bun run audit --strict gates on it too.
Working on the theme
Symlink the folder instead of packaging it:
code --uninstall-extension leandromatos.pre
ln -s "$PWD/vs-code" ~/.vscode/extensions/leandromatos.pre-dev
VS Code watches the theme file and repaints on save, so bun run watch gives you the
whole editor as the preview. bench/ holds one file per language worth checking, so you
compare the same screen every time.
Two built-in commands do the rest. Developer: Generate Color Theme From Current Settings
dumps every resolved key, including the ones you never set. Developer: Inspect Editor Tokens and Scopes tells you which scope owns the symbol under the cursor, which is the
only reliable way to fix a syntax colour.
Licence
MIT. See LICENSE.
engines.vscode tracks the version src/registry.json was read from, because the theme
sets keys that only exist from that version on. Re-run bun run registry after upgrading
VS Code and the floor moves with it.