From 635829a5c17be4fd4bc30866e2b361c4ea2876e1 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 25 Nov 2026 10:02:29 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE --- tools/gen_themes.zig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tools') diff --git a/tools/gen_themes.zig b/tools/gen_themes.zig index 4f3946ad..b9a9adb0 100644 --- a/tools/gen_themes.zig +++ b/tools/gen_themes.zig @@ -72,6 +72,10 @@ const Theme = struct { lineno: Rgb, scroll_track: Rgb, scroll_thumb: Rgb, + /// A message's error ink (colors.Roles.err): diagnostic.error's, else + /// error's, else the theme's red (UX E3: neonotte's diagnostic.error is + /// an underline only). + diagnostic_error: ?Rgb = null, palette: ?[16]Rgb, }; @@ -361,6 +365,7 @@ fn helixTheme(arena: std.mem.Allocator, stem: []const u8, h: Helix) !Theme { // anything else in the theme's greys) for the thumb riding it .scroll_track = h.get("ui.statusline", .bg) orelse page, .scroll_thumb = sel, + .diagnostic_error = h.first(&.{ .{ "diagnostic.error", .fg }, .{ "error", .fg } }) orelse h.color("red"), .palette = null, }; } @@ -575,6 +580,8 @@ fn readZed(arena: std.mem.Allocator, gpa: std.mem.Allocator, path: []const u8, t .lineno = z.need("editor.line_number"), .scroll_track = z.need("scrollbar.thumb.border"), .scroll_thumb = z.need("scrollbar.thumb.background"), + // its status colour, else the palette's red (colors.zig) + .diagnostic_error = if (z.style.get("error") != null) z.need("error") else null, .palette = pal, }); } -- cgit v1.3