summaryrefslogtreecommitdiff
path: root/core/colors.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 12:00:13 -0300
committerGabriel Schneider <[email protected]>2026-11-25 12:09:48 -0300
commit8af71053adc306b81c39429d6d1758bb6c81d363 (patch)
tree4f4dd30cfba4db91da523104025fe544d2fc1a6b /core/colors.zig
parent40f4750dc3fe870349c13649d22b4687896bbf7b (diff)
parentae138cd257f862f226f3f9561b98b7c0518bfcf5 (diff)
downloadpardes-8af71053adc306b81c39429d6d1758bb6c81d363.tar.gz
pardes-8af71053adc306b81c39429d6d1758bb6c81d363.zip
walk UI M7: the fix round's X1 (lrzulkwu 40f4750dc3fe: band rows in the dumps and the digest (the soak's `views[0].rects` class), a picker's band capped at 40 % of its host pane at open E5.1, the band under the head E5.2, the notice row cut with `…` E5.4, a blank each side of a step's rule E5.5, Help's chord and word with its group as right-aligned meta E5.6, a doc with no room on the notice row E5.10, full-height `│` in the window E5.9, the tag rule under a band over a terminal E5.11) merged with X2 (suvlqwul ae138cd257f8: the soak typist's q guard, a message's detail only on request E5.3/D13, the err role's fallback E5.7, ` · N lines` kept dim after a search's count (E7's reversal of E5.8), a list of places in one column with its places dim E7 2b, the landing line at 1.5:1 and its span at 1.9:1 E7 7b, code actions Enter cannot apply dim with meta `command`/`other files` E5.12), both on G4's lurxouvq, resolved by meaning: the only text conflict was test/snapshots/fsearch.golden; Messages.noticeRow (X1's left-text cut and doc line, its `*Pardes` signature) and X2's D13 (detailUnder, detailAt, act, rollUp) touch different functions and merged clean, as did Core.zig (X1's sync, X2's updateInner arms) and Pick.zig (X1's `cap` and bandRows, X2's rowAt actions arm and steps' place column); BY MEANING: X1's E3 rule gives the band's last list step the remaining width, so X2's place column (padded to the widest place shown, Pick.steps) is no longer cut at 52 cells and still lines up (a row with a place is cut from the right by Band.cutRow, its `pre` set, so the column never shifts), and the actions picker's one step is the band's width, so its meta `command`/`other files` stands at the band's right end (X2's reading 8 asked for exactly that); TESTS (the merge's checks): Pick "a list of places ..." also asks the band's drawn rows (Band.of, band.line): the last step ends at the band's edge and the two rows' code in one column; Pick "code actions: a row that cannot be applied ..." also asks the band's first row to end ` command` at the band's width; GOLDEN: fsearch regenerated and every changed row read: against X1 only X2's rows (`g.txt:2:1: MARK a` and `6:1: MARK b` padded to `10:1: MARK c`'s column in list and ctrln, row 16's ` · N lines` cells in the dim ink); against X2 only X1's (the band from the row under the head, the reader borrowing a row so its body shows line 9 / 11, the stray `│` under the `/` prompt gone); no other golden moved; core-test 1095/1266 (171 skipped; X1 1090/1261 + X2 1088/1259 over the base's 1083/1254), the two extended tests filtered 11/11 each; process-test 1 of 147 failed before the update (fsearch, the conflicted golden) and fsearch 0 of 1 after it
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.zig54
1 files changed, 45 insertions, 9 deletions
diff --git a/core/colors.zig b/core/colors.zig
index b2069465..4f58aed5 100644
--- a/core/colors.zig
+++ b/core/colors.zig
@@ -586,7 +586,8 @@ pub const ChromeTheme = struct {
.search_bg = th.search_bg orelse th.sel_bg,
.search_fg = th.search_fg orelse th.sel_fg,
.tag_reading_bg = reading,
- .diagnostic_error = th.diagnostic_error orelse (th.fg orelse th.tag_fg),
+ // 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),
@@ -643,8 +644,8 @@ 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.25;
- pub const hit_current_floor: f32 = 1.6;
+ 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 Inks {
@@ -692,7 +693,7 @@ pub const Roles = struct {
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 ink, &message_grounds, ink_floor);
+ r.err = pushAway(th.diagnostic_error orelse if (th.palette) |pal| pal[1] else ink, &message_grounds, ink_floor);
r.warn = pushAway(th.diagnostic_warning orelse ink, &message_grounds, ink_floor);
r.question = pushAway(th.diagnostic_info orelse ink, &message_grounds, ink_floor);
r.hint = pushAway(th.diagnostic_hint orelse ink, &message_grounds, ink_floor);
@@ -794,8 +795,10 @@ fn selectionOf(own: [3]u8, ground: [3]u8, text: [3]u8) [3]u8 {
/// 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); moved on toward the ink
-/// until it stands off the page at `floor`, as far as the ink allows.
+/// (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);
@@ -806,6 +809,22 @@ fn hitOf(page: [3]u8, hue: [3]u8, ink: [3]u8, t: f32, floor: f32) [3]u8 {
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) {
@@ -1586,7 +1605,9 @@ test "every theme's walk UI roles meet their floors on every ground they are dra
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));
- for ([_][3]u8{ r.hit, r.hit_current }, [_]f32{ Roles.hit_floor, Roles.hit_current_floor }) |ground, floor| {
+ // 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 });
@@ -1602,13 +1623,15 @@ test "every theme's walk UI roles meet their floors on every ground they are dra
test "neonotte84's and acme's roles are the ones UX derived (DESIGN.md D4, tools/roles.py)" {
const Want = struct { name: []const u8, text: ?[3]u8, dim: [3]u8, rule: [3]u8, key: [3]u8, match: [3]u8, reading: [3]u8, hit: [3]u8, hit_current: [3]u8 };
+ // The hit grounds past UX's 18 % / 32 % mix, to 1.5:1 and 1.9:1 off the
+ // page (UX E7 7b).
const wants = [_]Want{
- .{ .name = "neonotte84", .text = .{ 0xb5, 0xbf, 0xe3 }, .dim = .{ 0x70, 0x76, 0x8f }, .rule = .{ 0x4c, 0x50, 0x63 }, .key = .{ 0xf8, 0xde, 0xd9 }, .match = .{ 0xf1, 0xa2, 0x71 }, .reading = .{ 0x29, 0x27, 0x1e }, .hit = .{ 0x36, 0x28, 0x2a }, .hit_current = .{ 0x52, 0x38, 0x31 } },
+ .{ .name = "neonotte84", .text = .{ 0xb5, 0xbf, 0xe3 }, .dim = .{ 0x70, 0x76, 0x8f }, .rule = .{ 0x4c, 0x50, 0x63 }, .key = .{ 0xf8, 0xde, 0xd9 }, .match = .{ 0xf1, 0xa2, 0x71 }, .reading = .{ 0x29, 0x27, 0x1e }, .hit = .{ 0x47, 0x32, 0x2e }, .hit_current = .{ 0x5f, 0x3f, 0x33 } },
// acme's key and match a little darker than UX's #5c5c8d and
// #974d00 (which hold on its tag and its #9eeeee): a reading pane's
// band's selection is pushed off the reading ground (#9eeeee is
// 1.12:1 off #f3f0cc), and they read on that one too.
- .{ .name = "acme", .text = null, .dim = .{ 0x7a, 0x86, 0x86 }, .rule = .{ 0xa8, 0xb7, 0xb7 }, .key = .{ 0x55, 0x55, 0x83 }, .match = .{ 0x8f, 0x48, 0x00 }, .reading = .{ 0xf3, 0xf0, 0xcc }, .hit = .{ 0xec, 0xd8, 0xbb }, .hit_current = .{ 0xdd, 0xbc, 0x99 } },
+ .{ .name = "acme", .text = null, .dim = .{ 0x7a, 0x86, 0x86 }, .rule = .{ 0xa8, 0xb7, 0xb7 }, .key = .{ 0x55, 0x55, 0x83 }, .match = .{ 0x8f, 0x48, 0x00 }, .reading = .{ 0xf3, 0xf0, 0xcc }, .hit = .{ 0xe6, 0xcd, 0xae }, .hit_current = .{ 0xd9, 0xb4, 0x90 } },
};
for (wants) |want| {
const chrome = ChromeTheme.fromTheme(&themes[themeIndex(want.name).?]);
@@ -1621,3 +1644,16 @@ test "neonotte84's and acme's roles are the ones UX derived (DESIGN.md D4, tools
};
}
}
+
+test "the err role falls back from diagnostic.error's ink to error's, then to the theme's red (UX E3): neonotte84's (its diagnostic.error an underline only) is its red, acme's its palette's" {
+ const neonotte = &themes[themeIndex("neonotte84").?];
+ // neonotte.toml: "error" = { fg = "red" }, its palette's red #ff7ea2.
+ try std.testing.expectEqual([3]u8{ 0xff, 0x7e, 0xa2 }, neonotte.diagnostic_error.?);
+ for ([_][]const u8{ "neonotte84", "acme" }) |name| {
+ const chrome = ChromeTheme.fromTheme(&themes[themeIndex(name).?]);
+ const err = chrome.roles.err;
+ // Red: its red channel well over the others, on the page and the tags.
+ try std.testing.expect(err[0] > err[1] + 40 and err[0] > err[2] + 40);
+ }
+ try std.testing.expectEqual([3]u8{ 0xaa, 0x22, 0x22 }, ChromeTheme.fromTheme(&themes[themeIndex("acme").?]).diagnostic_error);
+}