summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 10:02:29 -0300
committerGabriel Schneider <[email protected]>2026-11-25 10:04:37 -0300
commit635829a5c17be4fd4bc30866e2b361c4ea2876e1 (patch)
tree239c786326408e44a8d1f1bba42be492e88beea0 /core
parent98f5abfc10d9984a69940a6805d974018e5ea01e (diff)
downloadpardes-635829a5c17be4fd4bc30866e2b361c4ea2876e1.tar.gz
pardes-635829a5c17be4fd4bc30866e2b361c4ea2876e1.zip
colors, tools/gen_themes.zig: the err role falls back from a theme's diagnostic.error ink to its error ink, then to its red (UX D4/D14, E3, E5 fix 7), so an invalid pattern's reason in a prompt (Prompt.head's .err span, drawn in roles.err) and a message's error glyph and ghosts are red on the imported themes: THE CAUSE: the generator wrote no diagnostic_error for a helix theme (neonotte's "diagnostic.error" is an underline only) and colors.zig fell back to the body's ink, so UX2 measured the reason in fg #cdd6f4 (P2-L 13); THE FIX: gen_themes.zig's Theme has diagnostic_error, a helix theme's from diagnostic.error's fg, else error's fg, else its red (its [palette] red, else the terminal's), a zed theme's from its `error` status colour; colors.zig's ChromeTheme.diagnostic_error and Roles.err fall back to the palette's red (index 1) before the ink, for a theme that names none and has a palette (acme: #aa2222; dark and helix keep their ink: no palette); the err role is still pushed to 4.5:1 on the tags and the page (the floors test passes for every bundled theme); ChromeTheme.diagnostic_error also colours a +Errors row, a diagnostic's underline and the notice row's error glyph, which move to the same red on those themes (the themes pardes ships its own colours for, orchard first, are as they were); TEST FIRST: colors.zig "the err role falls back from diagnostic.error's ink to error's, then to the theme's red (UX E3): ..." (on the base: neonotte84's diagnostic_error null, colors.zig:1628); passes now, with every colors test
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core')
-rw-r--r--core/colors.zig18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/colors.zig b/core/colors.zig
index b2069465..3325671c 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),
@@ -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);
@@ -1621,3 +1622,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);
+}