summaryrefslogtreecommitdiff
path: root/core/colors.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 02:44:20 -0300
committerGabriel Schneider <[email protected]>2026-11-26 03:32:07 -0300
commit60e85abe53debc0c8dd8986b748e9c86086e0007 (patch)
treefe4771a54916638b9d85f04d561c0459f795802f /core/colors.zig
parent0fb5f04ad236a6ce9e22c94be2847f4fdb0735f2 (diff)
downloadpardes-60e85abe53debc0c8dd8986b748e9c86086e0007.tar.gz
pardes-60e85abe53debc0c8dd8986b748e9c86086e0007.zip
body_layer, Places, Query, Output, Tables, File, Prompt, Pick, Core: the body draws every colour from the chrome (the themes programme's L2b; DESIGN.md R7-R12, B5, B6, G7), worked out once a theme change by Chrome.of and read by `p.chrome()`, never by a theme's own fields or the old views: ONE SELECTION FAMILY (R7): the primary range, a `gw` label and a target with no number on `page.selection` in its ink, a multi-cursor head that selection reversed; every other range, a hover, a look preview, `m a`/`m i`'s region, a selecting prompt's dimmed preview and a query pane's current row on `selection_secondary` (the page halfway toward the selection in OKLab) in the text's own ink, where they were four sRGB mixes (25 % and 50 % toward a page that was `dark`'s tag) and a secondary drew `sel_fg`; the B1, B2 and B3 sweeps the chrome's `sweeps` (select, exec on the error hue, look on the added hue; acme its own), the body's and the tags' alike, where body_layer.buttonTints tinted the selection toward the keyword, string and number; HITS (R8, G7 as the designer's position): every place, a picker's landing line, a query pane's and a results pane's match on `hit` in the text's ink (was the theme's search ink), the current place and a landing line's matched span solid in the hue with the page's ink (`hit_current`, `hit_current_text`), where Roles drew a third tone step (1.9:1) that 68 themes could not show and a query pane its search ground; a search whose field is no regex dims its last places, the current on `hit` and the rest on `hit_faint` (new: the page halfway toward the hit, R7's secondary for hits; DESIGN.md is silent); SEVERITIES (R9): a message's words and detail after its line (Messages.inkOn, new: an error, a warning and a question their severity's ink on that ground, an echo, a notice and progress its dim ink), a diagnostics list's labels, a rename's struck name and its new one, each `page.severity`, where they were the theme's raw diagnostic inks or Roles' pushed ones; DIFF GROUNDS (R10): a patch's rows, changed words and faint lines (File.recolorSyntax), a pipe prompt's and a code action's ghost rows, `add` and `del` with the page's text, where colors.Grounds mixed the page 18 %, 28 % and 7 % toward the palette's green and red once a frame; THE REST: line numbers `line_number` and the caret's `line_number_current` (R12: derived where a theme has none, it was the plain number), the wrap marker the line numbers', a tree's guides (a call stack's) and their wrap pads the page's dim ink (were the info ink: a guide is meta, B5's dim row), a location the line numbers' ink, keys, `▸` and the sam fence `page.key`, context rows, a table's header and a hover's ghost lines on the plain tag's ground (its ink for the hover), a table's rules the page's rule ink (were `border orelse lineno`), the rail and thumb the chrome's, the body's page and text `page` (a theme that leaves its page to the host leaves it its text, as before), syntax `syntax`; DELETED: Core.bodyChrome and its cache (`body_chrome`: a whole Theme compared with meta.eql for every decorated row and every wrap-pad cell, C1's A7), body_layer.buttonTints and buttonInks, the Grounds recipe (colors.Grounds is the library's view on the chrome now: lib_syntax exports it, test/consumer pins its relations), Roles.hit and hit_current with hitOf and their floors, ChromeTheme's search_fg, diagnostic_info, diagnostic_hint and lineno (nothing reads them now); every value is Chrome.of's, worked out at a theme change (finishThemeInitialization, setThemeIndex, previewTheme, loadThemeFile), never a frame, a row or a cell: the one new one, `hit_faint`, is one OKLab mix there; RUN (TEST FIRST): Places.zig "places: each on the hit ground in its text's own ink, the current one solid ... the selection over it; a search whose field is no regex dims them, the rest faint" (orchard: after `/alpha`, Enter and `j`, the current place `hit_current` in `hit_current_text`, the other `hit` in the page's text; searched again, its current under the selection; with `(` the others `hit_faint`): fails on the base at its current place (Roles' 1.9:1 step under the text's ink, where the hue in the page's ink is asked; its first version, asked during the live prompt, failed there on #3c614a: the body's selection is the current place then, drawn over it as before); Query.zig "a query pane's hits are the body's ..." (a `/alpha` query pane: the row's match `hit` in the text's ink, the owner's current place solid, the current row `selection_secondary` between its places and to its end, none below): fails on the base at Query.zig (expected #917a53, found #5e4923, the search ground); body_layer.zig "the body's selections are one family (R7) ..." (`eC` in orchard: the primary on `page.selection` in its ink, the other range on `selection_secondary` in the text's ink, its head reversed, a B2 sweep held over beta on `sweeps[1]`): fails on the base at body_layer.zig (expected #24382c, found #243a2d); body_layer.zig "the body's surfaces take every colour from the chrome: none reads a theme's own fields or the old views (DESIGN.md B6)" (the source test: body_layer, Places, Query, Output, Tables, File, Prompt, Pick, jj and ansi, their code before their tests: `theme()` read for its name alone, no chromeTheme(), bodyChrome, .roles, Grounds or LegacyTheme); re-pinned to the chrome and failing on the base: Prompt.zig's pipe ghosts (del.row #331a12, was Grounds' #302b25) and `/`'s `▸` (page.key #add38a, was Roles' #bada9d), Pick.zig's code action ghosts and its landing line, body_layer's motion targets, the build error's `✗` in `page.severity[0]`; colors.zig "line numbers stay quiet ..." (a ThemeFile with no current number: R12's derived one, 4.5:1), look.zig's hover preview on `selection_secondary`, test/output.zig and test/panes.zig's results colours (hit, page text, line numbers, the warning severity); GOLDENS re-recorded (13, orchard unless said), each class read: (1) R8 hit ink: a match on #5e4923 (orchard's own search ground, kept as its `hit`) in the text #e5eee5 where its search ink #f7e4a5 was: callstack 6 cells, psearch 15, stepgrain 26, lsprelpath 11; (2) G7 current hit: lsprelpath row 20, the owner's current place in a query row, #0d1410 on #917a53 (the hue held 4.5:1) where it was #f7e4a5 on #5e4923, 9 cells; (3) R7 secondary: #243a2d (sRGB half) to #24382c (OKLab half), the text's own ink where `sel_fg` #f5f7ee was: multicursor 2 cells and selregex 24 (secondary ranges), stepgrain 285 and lsprelpath 185 (a query pane's current row); (4) R10 diff grounds: diffview rows 12-19 (the diff pane's own rows: added #263025 to #132503, deleted #302b25 to #331a12, 558 cells; the same values the command pane's diff took in L2c), diffstack rows 26-29 (a faint added line #171f18 to #101c0b, changed words #364131 to #203900 and #453832 to #53251b), pagercolor rows 36-37 (a +Pager's faint lines: #1a1d18 to #211812, #171f18 to #101c0b); markers and syntax inks unchanged; (5) a tree's guides: callstack rows 11-21, #92d1de (the info ink) to #666f68 (the page's dim ink), 35 cells; (6) key ink: fsearch's `▸`, #bada9d (pushed over seven tag grounds) to #add38a (the accent held on the page); (7) R7 exec sweep: headersweep and headersweep-restored, a B2 sweep on the header, #f5f7ee on #5b7e5a (the selection tinted toward the string) to #e5eee5 on #4c251b (the error hue a selection step off the page), 8 and 16 cells (draw.zig's sweeps, moved with buttonTints); (8) R12: themesel row 26, the caret line's number in solarized_dark (#586e75 to #7f9193) and acme (#999980 to #74746a), themes with no current-line number of their own; no text moved, no other golden; GATES: core-test 1132/1305 (173 skipped; the merge's 1128/1301 + 4), shell-test 1353/1356 (3 skipped), pane-test 184/185 (1 skipped), behaviour-test 280/280 and --replay 20 seeds of 70 steps, 0 failures, process-test 0 of 147 failed (3 skipped; 13 re-recorded above, ttyhelp unmoved), term-test 17/17, kitty-test 45/45; gui unit-test 1957/1961 (4 skipped; its one failure the known BaselineHarnessMismatch; test/consumer's Grounds relations pass on the chrome's rows); PICTURES (the S kit, 26 px, 100x30, `Jumps walk`; before = install74's pardes-gui, after = this tree's Debug gui): .scratch/themes/L2b/png/, `<state>-<theme>-before|after.png` and `pair-<state>-<theme>.png` side by side, in dark, neonotte84, orchard and acme: `search` (a live `/words`: the current place is the body's selection, as before), `landed` (Enter, then `j`: the current place the solid chip), `selhit` (`x` over a hit), `grep` (SPC f g count: the preview's landing line and matched span), `error` (`:zig build`'s error words after report.zig's line 11: dark's were its grey text, red now), `diff` (a .diff file's rows); the dump and the digest unchanged (`body_chrome` was derived, `theme_chrome` local), so no fuzz or soak; load 3.2 to 9.7
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/colors.zig')
-rw-r--r--core/colors.zig133
1 files changed, 20 insertions, 113 deletions
diff --git a/core/colors.zig b/core/colors.zig
index 315d1fc9..44a2d415 100644
--- a/core/colors.zig
+++ b/core/colors.zig
@@ -553,10 +553,13 @@ pub const Chrome = struct {
selection_secondary: [3]u8,
/// The pointer buttons' sweeps: select, exec, look (acme's meanings).
sweeps: [3]Theme.Sweep,
- /// Search: a hit's ground, and the current one's ground and ink.
+ /// Search: a hit's ground, and the current one's ground and ink; a
+ /// search's last places while its field is no regex, dimmed: the page
+ /// halfway toward the hit (as `selection_secondary` is the selection's).
hit: [3]u8,
hit_current: [3]u8,
hit_current_text: [3]u8,
+ hit_faint: [3]u8,
add: Diff,
del: Diff,
/// The Changes layer's lanes, a pin each (`lanes_len` of them), and
@@ -726,6 +729,7 @@ pub const Chrome = struct {
// ink (vim's IncSearch): room for it in every theme.
c.hit_current = hold(hue, &.{page}, text_floor);
c.hit_current_text = page;
+ c.hit_faint = mixOklab(page, c.hit, 0.5);
// Every ground's inks; on the tags and the status row, the
// tag's selection rebuilt on each where it stands too near it.
@@ -1061,31 +1065,17 @@ pub fn synInk(th: *const LegacyTheme, sy: @import("syntax.zig").Syn) ?[3]u8 {
}
/// The grounds a style byte's high bits name (syntax.ground_add and the
-/// rest) in a theme: a row added or removed on a ground a little way from
-/// the page toward the theme's green or red (its own ANSI ones where it has
-/// a palette), a stronger one, a faint one, and the row's marker in that
-/// hue, pushed toward the ink until it reads on the row's ground. Syntax
-/// colours are drawn over a ground unchanged.
+/// rest) in a theme, for the library: its chrome's added and deleted rows
+/// (R10). Syntax colours are drawn over a ground unchanged.
pub const Grounds = struct {
add: Ground,
del: Ground,
- pub const Ground = struct { row: [3]u8, emph: [3]u8, line: [3]u8, ink: [3]u8 };
+ pub const Ground = Chrome.Diff;
pub fn of(th: *const LegacyTheme) Grounds {
- const page = th.bg orelse th.tag_bg;
- const ink = th.fg orelse th.tag_fg;
- const green: [3]u8 = if (th.palette) |pal| pal[2] else .{ 0x2e, 0xa0, 0x43 };
- const red: [3]u8 = if (th.palette) |pal| pal[1] else .{ 0xcf, 0x22, 0x2e };
- return .{ .add = ground(page, ink, green), .del = ground(page, ink, red) };
- }
-
- fn ground(page: [3]u8, ink: [3]u8, hue: [3]u8) Ground {
- const row = mixOklab(page, hue, 0.18);
- var marker = hue;
- var step: usize = 0;
- while (step < 4 and contrast(marker, row) < 3) : (step += 1) marker = mixOklab(marker, ink, 0.4);
- return .{ .row = row, .emph = mixOklab(page, hue, 0.28), .line = mixOklab(page, hue, 0.07), .ink = marker };
+ const c = Chrome.of(&.fromLegacy(th.*));
+ return .{ .add = c.add, .del = c.del };
}
/// The ground of a byte's hue, if it has one.
@@ -1294,17 +1284,13 @@ pub const ChromeTheme = struct {
border: [3]u8,
empty_col: [3]u8,
search_bg: [3]u8,
- search_fg: [3]u8,
tag_reading_bg: [3]u8,
diagnostic_error: [3]u8,
diagnostic_warning: [3]u8,
- diagnostic_info: [3]u8,
- diagnostic_hint: [3]u8,
box: [3]u8,
box_dim: [3]u8,
column_box: [3]u8,
column_box_dim: [3]u8,
- lineno: [3]u8,
scroll_track: [3]u8,
scroll_thumb: [3]u8,
roles: Roles,
@@ -1342,18 +1328,14 @@ pub const ChromeTheme = struct {
.border = separatorOf(th),
.empty_col = th.empty_col orelse separatorOf(th),
.search_bg = th.search_bg orelse th.sel_bg,
- .search_fg = th.search_fg orelse th.sel_fg,
.tag_reading_bg = reading,
// A theme's error ink, else its palette's red (UX E3).
.diagnostic_error = th.diagnostic_error orelse if (th.palette) |pal| pal[1] else (th.fg orelse th.tag_fg),
.diagnostic_warning = th.diagnostic_warning orelse (th.fg orelse th.tag_fg),
- .diagnostic_info = th.diagnostic_info orelse (th.fg orelse th.tag_fg),
- .diagnostic_hint = th.diagnostic_hint orelse (th.fg orelse th.tag_fg),
.box = th.box,
.box_dim = th.box_dim,
.column_box = th.column_box orelse th.num,
.column_box_dim = th.column_box_dim orelse mix(th.column_box orelse th.num, th.tag_bg),
- .lineno = th.lineno,
.scroll_track = th.scroll_track,
.scroll_thumb = th.scroll_thumb,
.roles = .of(th, th.tag_bg, active_bg, reading),
@@ -1387,10 +1369,6 @@ pub const Roles = struct {
/// The letters a query matched: an ink, never a ground, 4.5:1 on every
/// tag ground and on the selection.
match: [3]u8,
- /// The body's places and a preview's landing line, and the current
- /// one (its matched span): grounds off the page, its ink on them 4.5:1.
- hit: [3]u8,
- hit_current: [3]u8,
/// A message's ink by its kind (Messages.ink): 4.5:1 on the tags and
/// the page.
err: [3]u8,
@@ -1403,8 +1381,6 @@ pub const Roles = struct {
pub const rule_floor: f32 = 1.8;
pub const rule_ceiling: f32 = 2.5;
pub const ink_floor: f32 = 4.5;
- pub const hit_floor: f32 = 1.5;
- pub const hit_current_floor: f32 = 1.9;
pub const reading_distance: f32 = 0.04;
pub fn on(r: *const Roles, ground: TagGround) *const RoleInks {
@@ -1436,20 +1412,6 @@ pub const Roles = struct {
r.key = pushAway(th.box, &tag_grounds, ink_floor);
r.match = pushAway(matchHue(th), &tag_grounds, ink_floor);
const page = th.bg orelse null_page;
- const body_ink = th.fg orelse th.tag_fg;
- const dark = relativeLuminance(page) < 0.18;
- // The theme's search ground where it stands off the page and the
- // body reads on it; else the page a little way toward its hue (the
- // warm accent's without one). The current one as far past the hit
- // as 32 % is past 18 % (38 past 22 on a light page).
- const hue = th.search_bg orelse th.num;
- const own = th.search_bg != null and contrast(hue, page) >= hit_floor and contrast(body_ink, hue) >= ink_floor;
- const at: f32 = if (own) 1 else if (dark) 0.18 else 0.22;
- r.hit = if (own) hue else hitOf(page, hue, body_ink, at, hit_floor);
- const past: f32 = if (dark) 0.32 / 0.18 else 0.38 / 0.22;
- r.hit_current = hitOf(page, hue, body_ink, at * past, hit_current_floor);
- // Never fainter than the hit, where the ink holds both short.
- if (contrast(r.hit_current, page) < contrast(r.hit, page)) r.hit_current = r.hit;
const message_grounds = [_][3]u8{ plain, focused, reading, page };
const ink = th.fg orelse th.tag_fg;
r.err = pushAway(th.diagnostic_error orelse if (th.palette) |pal| pal[1] else ink, &message_grounds, ink_floor);
@@ -1552,48 +1514,6 @@ fn selectionOf(own: [3]u8, ground: [3]u8, text: [3]u8) [3]u8 {
return best;
}
-/// A ground off `page` toward `hue` at `t` (past 1, beyond the hue, as far
-/// as the gamut goes), held where the body's `ink` reads on it at 4.5:1
-/// (or its own on the page, where that is less); on toward the hue, the
-/// least way that stands off the page at `floor`, where the ink still
-/// reads on it; else moved on toward the ink until it stands off the page
-/// at `floor`, as far as the ink allows.
-fn hitOf(page: [3]u8, hue: [3]u8, ink: [3]u8, t: f32, floor: f32) [3]u8 {
- const a = toOklab(page);
- const b = toOklab(hue);
- const ink_floor = @min(Roles.ink_floor, contrast(ink, page));
- var k = t;
- var c = fromOklab(.{ a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k, a[2] + (b[2] - a[2]) * k });
- while (contrast(ink, c) < ink_floor and k > 0) {
- k -= t / 50;
- c = fromOklab(.{ a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k, a[2] + (b[2] - a[2]) * k });
- }
- // Found by halves, seven mixes: the nearer the hue, the further off
- // the page (UX E7 7b: a landing line 1.5:1, its span 1.9:1).
- if (contrast(c, page) < floor and k < 1 and contrast(hue, page) >= floor) {
- var lo = k;
- var hi: f32 = 1;
- var far = hue;
- for (0..7) |_| {
- const mid = (lo + hi) / 2;
- const m = fromOklab(.{ a[0] + (b[0] - a[0]) * mid, a[1] + (b[1] - a[1]) * mid, a[2] + (b[2] - a[2]) * mid });
- if (contrast(m, page) < floor) lo = mid else {
- hi = mid;
- far = m;
- }
- }
- if (contrast(ink, far) >= ink_floor) c = far;
- }
- const start = c;
- var step: f32 = 1;
- while (contrast(c, page) < floor and step <= 50) : (step += 1) {
- const next = mixOklab(start, ink, step / 100);
- if (contrast(ink, next) < ink_floor) break;
- c = next;
- }
- return c;
-}
-
/// A reading pane's tag (UX DESIGN.md D4): the theme's own where it stands
/// off the tag, else the tag shifted toward paper yellow by 0.04 in OKLab
/// and lighter by half that on a dark tag (darker on a light), so it reads
@@ -1791,7 +1711,6 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8) bool {
theme.name = view.name;
p.theme_chrome = .of(&theme, &view);
- p.body_chrome = .{ .theme = view, .chrome = p.theme_chrome };
const old = p.custom_theme;
p.custom_theme = view;
if (old) |theme_value| p.gpa.free(theme_value.name);
@@ -1828,13 +1747,10 @@ fn inOldNames(source: [:0]const u8) bool {
}
/// The session's theme's chrome, at its start (Pardes.init, a Restore):
-/// never one the window previews (`previewTheme`); the body's copy of it
-/// (Core.bodyChrome's, keyed by the theme) made with it, not again at the
-/// first frame.
+/// never one the window previews (`previewTheme`).
pub fn finishThemeInitialization(p: *Pardes) void {
const theme = if (p.custom_theme) |*custom| custom else &legacy_themes[p.settings.theme];
p.theme_chrome = if (p.custom_theme != null) .fromTheme(theme) else .of(&themes[p.settings.theme], theme);
- p.body_chrome = .{ .theme = theme.*, .chrome = p.theme_chrome };
}
/// Themes near `name`, a line of them, for a Theme given a name there is
@@ -1915,7 +1831,6 @@ pub fn previewTheme(p: *Pardes, index: ?usize) void {
if (p.theme_preview) |had| if (had == i) return;
p.theme_preview = @intCast(i);
p.preview_chrome = .of(&themes[i], &legacy_themes[i]);
- p.body_chrome = .{ .theme = legacy_themes[i], .chrome = p.preview_chrome };
}
pub fn setThemeIndex(p: *Pardes, index: usize) void {
@@ -1923,7 +1838,6 @@ pub fn setThemeIndex(p: *Pardes, index: usize) void {
(p.custom_theme == null and p.theme_file_path.get().len == 0 and
index == @as(usize, p.settings.theme))) return;
p.theme_chrome = .of(&themes[index], &legacy_themes[index]);
- p.body_chrome = .{ .theme = legacy_themes[index], .chrome = p.theme_chrome };
if (p.custom_theme) |theme_value| {
p.custom_theme = null;
p.gpa.free(theme_value.name);
@@ -2131,9 +2045,8 @@ test "native themes keep text and UI roles readable on their own surfaces" {
const chrome = ChromeTheme.fromTheme(&th);
const minimum: f32 = if (std.mem.eql(u8, name, "ink") or std.mem.eql(u8, name, "daybreak")) 7 else 4.5;
const text_colors = [_][3]u8{
- th.fg.?, th.kw, th.str, th.num, th.comment,
- chrome.diagnostic_error, chrome.diagnostic_warning, chrome.diagnostic_info, chrome.diagnostic_hint,
- };
+ th.fg.?, th.kw, th.str, th.num, th.comment,
+ } ++ chrome.resolved.page.severity;
for (text_colors) |fg| try std.testing.expect(contrast(fg, th.bg.?) >= minimum);
// Gutters are orientation aids, not source text: stay visible without
// competing with comments or pulling attention away from the body.
@@ -2153,7 +2066,7 @@ test "native themes keep text and UI roles readable on their own surfaces" {
try std.testing.expect(contrast(chrome.tag_active_bg, th.tag_bg) <= 1.6);
try std.testing.expect(contrast(chrome.tag_active_fg, th.tag_fg) <= 1.6);
try std.testing.expect(contrast(th.sel_fg, th.sel_bg) >= minimum);
- try std.testing.expect(contrast(chrome.search_fg, chrome.search_bg) >= minimum);
+ try std.testing.expect(contrast(chrome.resolved.hit_current_text, chrome.resolved.hit_current) >= Chrome.text_floor);
// ANSI black can intentionally match the page (for backgrounds). All
// other ANSI foregrounds, including bright black, remain legible.
for (th.palette.?[1..]) |fg| try std.testing.expect(contrast(fg, th.bg.?) >= minimum);
@@ -2219,6 +2132,7 @@ test "line numbers stay quiet without a current-line tag background" {
custom.lineno = .{ 70, 70, 70 };
custom.lineno_active = .{ 95, 95, 95 };
p.custom_theme = custom;
+ finishThemeInitialization(p);
p.sync();
const x = p.view().rects[0].x + config.GUTTER;
const y = p.view().rects[0].y + BOX_H;
@@ -2228,10 +2142,13 @@ test "line numbers stay quiet without a current-line tag background" {
try std.testing.expectEqual(Color{ .rgb = custom.bg.? }, surface.at(x, y).style.bg);
try std.testing.expect(surface.at(x, y).style.bold);
try std.testing.expect(!surface.at(x, y + 1).style.bold);
- // Old ThemeFile palettes need no new field, and do not regain the block.
+ // Old ThemeFile palettes need no new field: the current number is the
+ // text toward the page to 4.5:1 (R12), and the block not regained.
p.custom_theme.?.lineno_active = null;
+ finishThemeInitialization(p);
const fallback = try p.render(p.scratch.allocator());
- try std.testing.expectEqual(Color{ .rgb = .{ 70, 70, 70 } }, fallback.at(x, y).style.fg);
+ try std.testing.expectEqual(Color{ .rgb = p.chrome().line_number_current }, fallback.at(x, y).style.fg);
+ try std.testing.expect(contrast(p.chrome().line_number_current, custom.bg.?) >= Chrome.text_floor - 0.05);
try std.testing.expectEqual(Color{ .rgb = custom.bg.? }, fallback.at(x, y).style.bg);
try std.testing.expect(fallback.at(x, y).style.bold);
// Moving the caret clears the previous cue; editing the tag parks it.
@@ -2374,7 +2291,6 @@ test "every theme's walk UI roles meet their floors on every ground they are dra
const chrome = ChromeTheme.fromTheme(th);
const r = &chrome.roles;
const page = th.bg orelse null_page;
- const body_ink = th.fg orelse th.tag_fg;
const tags = [_][3]u8{ r.tag[0].ground, r.tag[1].ground, r.tag[2].ground, r.selected[0].ground, r.selected[1].ground, r.selected[2].ground, r.selected[3].ground };
const messages = [_][3]u8{ r.tag[0].ground, r.tag[1].ground, r.tag[2].ground, page };
for (r.tag ++ r.selected ++ [1]RoleInks{r.notice}) |inks| {
@@ -2401,15 +2317,6 @@ test "every theme's walk UI roles meet their floors on every ground they are dra
try checks.append(a, .{ .what = "reading", .got = oklabDistance(toOklab(chrome.tag_reading_bg), toOklab(th.tag_bg)), .floor = Roles.reading_distance });
for ([_][3]u8{ th.tag_fg, th.tag_active_fg orelse th.tag_fg }) |ink|
try checks.append(a, .{ .what = "text on reading", .got = contrast(ink, chrome.tag_reading_bg), .floor = @min(7, contrast(ink, th.tag_bg)) - 0.02 });
- const ink_floor = @min(Roles.ink_floor, contrast(body_ink, page));
- // A preview's landing line 1.5:1 off the page, its matched span (the
- // current hit) a step stronger, 1.9:1 (UX E7 7b: 1.29 read as faint).
- for ([_][3]u8{ r.hit, r.hit_current }, [_]f32{ 1.5, 1.9 }) |ground, floor| {
- const on = contrast(body_ink, ground);
- try checks.append(a, .{ .what = "hit", .got = contrast(ground, page), .floor = if (on < ink_floor + 0.3) 0 else floor });
- try checks.append(a, .{ .what = "ink on hit", .got = on, .floor = ink_floor - 0.01 });
- }
- try checks.append(a, .{ .what = "current over hit", .got = contrast(r.hit_current, page) - contrast(r.hit, page), .floor = 0 });
for (checks.items) |c| if (c.got < c.floor - 0.005) {
failed += 1;
std.debug.print("{s}: {s} {d:.2} under {d:.2}\n", .{ th.name, c.what, c.got, c.floor });