diff options
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/config.zig b/src/config.zig index a7d214b3..e6597881 100644 --- a/src/config.zig +++ b/src/config.zig @@ -433,6 +433,35 @@ pub const tty_paste_clipboard: []const Chord = &.{ /// terminal to read as output and nothing else. pub const tty_blank: enum { prompt, prompt_and_input } = .prompt; +/// The WCAG contrast ratio a filtered terminal foreground has to keep against +/// the default background before `Filter` will paint it in the theme colour +/// the projection chose. 1.0 is "the same colour"; 21.0 is black on white. +/// +/// `Filter` maps the default foreground and background roles FIRST — they are +/// the anchors Ghostty generates the 256-colour projection from — and every +/// other colour after them, by reducing it to its nearest canonical xterm key +/// and reading that key out of the projection. That reduction is a distance +/// between two RGB triples: it knows about hue and nothing about the page. The +/// cube's own corners ARE the two anchors, so the nearest key to a truecolour +/// extreme is the background itself — `\x1b[38;2;255;255;255m` on acme's +/// #ffffea paper resolved to #ffffea, ratio 1.000, text painted the colour of +/// the page under it. Every curated theme owns such a key: 231 on the light +/// one, 0 (ANSI black, which a shell writes with `\x1b[30m`) on both dark ones. +/// +/// A foreground that misses this floor is not mapped. It takes whichever of +/// the theme's own two anchors contrasts BETTER with the background actually +/// behind it, which is the choice the vendored renderer's `contrasted_color` +/// makes between white and black for the same reason. +/// +/// 1.5 is deliberately low: the point is legibility, not WCAG body text, and a +/// theme's comment and dim colours are MEANT to sit close to the page. Measured +/// across the curated three it rejects 12, 16 and 7 of 256 keys, where 3.0 +/// would reject 34, 92 and 41 and flatten a third of the dark palette. It also +/// has to stay below the contrast a theme's own pair achieves — 4.71 on `dark` +/// — or the fallback would fail the very test it answers. 1.0 accepts every +/// projected colour, collapses included. +pub const tty_filter_min_contrast: f64 = 1.5; + // ---- the tag line and the topbar ---- // The topbar is a HAND-PICKED subset in a fixed order, not a derivation: row 0 |
