summaryrefslogtreecommitdiff
path: root/core/colors.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 10:34:20 -0300
committerGabriel Schneider <[email protected]>2026-11-25 10:47:28 -0300
commit26022c82993777248b7958f1c97d452729139153 (patch)
tree4b357074b80ae630209741bb79cb301275a62051 /core/colors.zig
parentb17ff3c29dc5b0eb03fe471be9b96098cbb631f8 (diff)
downloadpardes-26022c82993777248b7958f1c97d452729139153.tar.gz
pardes-26022c82993777248b7958f1c97d452729139153.zip
colors: a picker's landing line stands 1.5:1 off the page and its matched span 1.9:1 (UX E7 7b, D7/D4): the hit grounds are found on toward the theme's search hue, the least way that stands off the page that far where the body's ink still reads on them at 4.5:1 (by halves, seven mixes: the first frame's role derivation, P2's perf fix, stays a fixed handful of contrasts), before the old move toward the ink: THE CAUSE: Roles.hit_floor 1.25 and hit_current_floor 1.6 (D4) with the ground mixed 18 % / 32 % toward the warm accent, so neonotte84's landing line was #36282a at 1.29:1 on its page against the prototype's 1.88:1 ("much fainter", UX2 E7); THE FIX: hit_floor 1.5, hit_current_floor 1.9, and colors.hitOf bisects the mix toward the hue between where it starts and the hue itself for the least one at the floor (only where the hue stands that far off and the ink reads on it; else as before, on toward the ink); the same grounds are a prompt's search hits and its current one (D14), which stand out as much; a theme's own search_bg counts only at 1.5:1 now; neonotte84's hit #47322e 1.52:1 and current #5f3f33 1.94:1, acme's #e6cdae 1.51:1 and #d9b490 1.91:1 (the UX-derived values test updated to them, noting the step past UX's 18 % / 32 %); TEST FIRST: P2's floors test "every theme's walk UI roles meet their floors ..." asks the landing line 1.5:1 and its span 1.9:1 (on the base: 340 hit grounds under those, dusk's 1.27, paper's 1.27 and 1.63, ...), passes for every bundled theme now; core-test 1087/1258 (171 skipped), process-test 0 of 147 failed (orchard's own search ground already stands off its page: no golden moved)
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.zig36
1 files changed, 29 insertions, 7 deletions
diff --git a/core/colors.zig b/core/colors.zig
index 3325671c..4f58aed5 100644
--- a/core/colors.zig
+++ b/core/colors.zig
@@ -644,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 {
@@ -795,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);
@@ -807,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) {
@@ -1587,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 });
@@ -1603,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).?]);