A theme is the most-installed extension and the easiest to get wrong. It is also
the one thing every surface must agree on. The TUI, the desktop app, the browser,
and the docs should not each invent what “muted text” means.
themes/night-flight-syntax.toml
schema_version = 1
id = "acpilot.night-flight-syntax"
name = "Night flight (syntax)"
appearance = "dark"
extends = "acpilot.night-flight"# inherit every token it does not set
Token tables are a closed set. text_mutted is an error naming the key, not a
token that silently does nothing. A theme that omits a token inherits it from the
theme named by extends. A theme with no extends must set every token, because
there is nothing left to inherit from.
CI measures every built-in theme. It checks seventeen foreground tokens (seven
interface, ten syntax) against both surfaces (bg and bg_panel). That is
34 pairs per theme, and each must clear WCAG AA (4.5:1). A pair below the line
fails the build with the token names and both ratios printed.
bg, bg_panel, and border are excluded, and deliberately. The first two are
the paper rather than the ink. WCAG 1.4.11 covers boundaries needed to identify a
control, not a hairline separator. Forcing 3:1 hairlines would make every theme
look like a wireframe.
The two surfaces have a rule of their own, because text contrast cannot see it. A
panel can be invisible while every token on it passes. bg_panel must sit
between 1.10:1 and 1.35:1 of bg. Below the floor the panel reads as the
background. Both built-ins were once at 1.06:1 and 1.08:1, panels you could only
find with a colour picker. Above the ceiling the panel has spent contrast the text
drawn on it needs, so the AA rule gets harder for every token at once. The window
is ratcn’s well ladder, adopted with its numbers.
That rule exists because of a real bug in this very manual. The sidebar’s selected
item once painted near-black text on a dark panel, and it was unreadable until
somebody measured it. “It looked fine on my monitor” is how a theme ships broken.
A theme outside the window still loads. It is a shade, not a broken file. acpilot tui prints the measurement with the token names when it does. Both built-ins sit
at 1.17:1, and CI fails if a change moves either out.
The gate lives in crates/acpilot-extensions and runs as
built_in_themes_meet_wcag_aa. CI gives it a step of its own, so a red build says
which check failed.
The two palettes every surface falls back to. Measured, not eyeballed: the ratios are the ones the contrast gate enforces.
Night flight
acpilot.night-flight
dark
preflight.rsFL 090
1// preflight: always carry a reserve2fnrefuel(litres:u32)->Fuel{3letreserve=0.15;4Fuel::new(litres,reserve)5}67// "minimum fuel" is not a suggestion8constMINIMUM:f64=45.0;
Interface
bg#070d18
bg_panel#141e33
border#24334a
text#e8edf6
text_muted#97a5b8
accent#f7c65c
accent_high#ffe3a8
success#59c98b
warning#f7c65c
danger#ff7a7a
Syntax
comment#7d8ca3
keyword#f7c65c
string#8ad6a0
number#e0a3ff
type#8fc7ff
function#ffd9a0
variable#e8edf6
constant#ffb3c1
operator#b9c4d4
punctuation#97a5b8
Paper
acpilot.paper
light
preflight.rsFL 090
1// preflight: always carry a reserve2fnrefuel(litres:u32)->Fuel{3letreserve=0.15;4Fuel::new(litres,reserve)5}67// "minimum fuel" is not a suggestion8constMINIMUM:f64=45.0;
Interface
bg#fbf7ef
bg_panel#ece5d5
border#ddd2bb
text#1a2333
text_muted#5f594a
accent#8a5a10
accent_high#6b4408
success#1f6b3f
warning#7a4a00
danger#a01f1f
Syntax
comment#6b6353
keyword#8a5a10
string#1f6b3f
number#6a2f8f
type#1a4f8a
function#7a3a00
variable#1a2333
constant#8a1f3f
operator#3a3a34
punctuation#5f594a
Solved from a terminal
theme_follow_terminal = true asks the terminal for its own background and foreground and solves a complete palette around them. These two were solved by that function when this page was generated, for a terminal at each end of the ramp.
Black terminal, white ink
#000000 on #ffffff
dark
preflight.rsFL 090
1// preflight: always carry a reserve2fnrefuel(litres:u32)->Fuel{3letreserve=0.15;4Fuel::new(litres,reserve)5}67// "minimum fuel" is not a suggestion8constMINIMUM:f64=45.0;
Interface
bg#000000
bg_panel#171717
border#373737
text#ffffff
text_muted#828282
accent#debe73
accent_high#ecdaaf
success#73de9f
warning#deaf73
danger#de7373
Syntax
comment#828282
keyword#debe73
string#73de93
number#c373de
type#73a8de
function#dea573
variable#ffffff
constant#de7396
operator#828282
punctuation#828282
Cream terminal, dark ink
#fdf6e3 on #59646a
light
preflight.rsFL 090
1// preflight: always carry a reserve2fnrefuel(litres:u32)->Fuel{3letreserve=0.15;4Fuel::new(litres,reserve)5}67// "minimum fuel" is not a suggestion8constMINIMUM:f64=45.0;
Interface
bg#fdf6e3
bg_panel#ebe5d3
border#c1bcad
text#59646a
text_muted#5a656b
accent#7c5f1d
accent_high#674f18
success#1b723f
warning#895b20
danger#a52727
Syntax
comment#5a656b
keyword#7c5f1d
string#1b7235
number#8627a5
type#2766a5
function#915622
variable#59646a
constant#a52751
operator#5a656b
punctuation#5a656b
The gallery is generated, not drawn by hand. cargo xtask docs-data writes
site/src/data/themes.json from the extensions the binary embeds, and a test
fails if the committed file drifts. The ratios shown are the ones the gate
enforces. That is the only way a preview can be trusted to describe the product.
The second row is not a built-in. It is the outcome of theme_follow_terminal
for two terminals: a black one and a cream one, one at each end of the ramp. The
page generated it with the same function the TUI calls, and it was audited before
it was written. It is there because “a palette is solved around your terminal” is
a claim a reader should be able to look at. The black terminal gets a dark theme
with a panel you can see. The cream one gets a light theme with the same window
and the same hue families. Neither was chosen by hand.
The importer reads the plist (dict, array, string, number, no external entities).
It maps the global background, foreground, caret, gutter and line highlight onto
the interface tokens. It maps scope rules onto the syntax tokens. Everything the
file does not define is inherited from the built-in with the same appearance, so
a minimal theme still works.
It is honest about the edges. Eight-digit colours lose their alpha, and the
importer says so. Unknown scopes are ignored. Any pair below WCAG AA is printed as
a warning with both tokens and the ratio. The result is an ordinary extension:
stored, checksummed, and blockable like any other. That is why the id must be
namespaced, and why acpilot.night-flight itself cannot be replaced.
The theme is a preference in config.toml, and saving the file is the switch.
Naming another id is enough:
[preferences]
theme = "acpilot.night-flight-syntax"
acpilot tui watches the user’s and the project’s settings and recolours the open
client. It names the theme in its status bar, so an edit in one window lands in
the other. The daemon sends the whole preferences object as the first frame of its
profile stream and again after every save. A browser or a window that cannot see
this machine’s files therefore follows without a restart. /app listens on its
palette stream and repaints an open tab. A file that does not parse, or an id no
loaded extension provides, leaves what is on screen alone and is reported. The
next save is read normally.
Naming a theme is not the only option. theme_follow_terminal = true asks the
terminal what its own background and foreground are. It solves a complete palette
around that pair:
[preferences]
theme_follow_terminal = true
The panel is pushed out of the background into the window above. The ink is pushed
out until it clears AA on that panel. The roles the terminal has no colour for
start from a hue. That covers a red for danger and an amber for accent. Each
takes the lightness that clears the same floor. The result goes through the same
audit as a file. A
palette that fails it is not shown. Two consequences are deliberate. A terminal
whose background sits near the middle of the ramp gets a palette solved around a
deepened background, because white on #808080 cannot clear AA. The terminal’s
own foreground is kept verbatim when it already passes. Turning the key off is the
switch back to the named theme, without a restart. Two terminals at opposite ends
of the ramp are in the gallery below, the black one and the cream one. The result
can therefore be seen rather than only described.
The two themes are ordinary extension directories under extensions/ at the
repository root:
extensions/acpilot.night-flight/
extension.toml
night-flight.toml
extensions/acpilot.paper/
extension.toml
paper.toml
include_str! embeds them, so a manifest that points at a missing asset is a
build error. They load through the same loader as an installed extension, and the
loader marks them built_in. They cannot be uninstalled. Only a different theme
can be selected for a profile. If the schema is incomplete, our own two themes are
the first to say so. That is the cheapest possible time to find out.
Theme ids are namespaced (publisher.name). That is why a variant pack ships
acpilot.night-flight-syntax and never night-flight.
Vibecoded, on purpose. While I am a software developer, I lack the time to hand-code all my ideas, and as a result this project is vibecoded withFreebuff.