From f316b46caea6ecf947989114c37af8288b37dbf5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 7 Nov 2026 00:27:21 -0300 Subject: themes: a theme may colour the tagline (the workspace row) on its own, tagline_bg and tagline_fg, an editor's status bar, resolved to the tag's colours without them (ChromeTheme); dark_plus takes VS Code's statusBar.background #007acc with white text, cited; the chrome floors test holds the pair to 4.5:1 and the default to the tag's; the theme and themesel snapshots move by that row Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/CHANGELOG.md | 4 ++++ src/colors.zig | 13 ++++++++++++- src/draw.zig | 7 +++---- src/themes/dark_plus.zig | 4 ++++ 4 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 8107f920..8bb5216c 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +- A theme may give the tagline (the workspace row) colours of its own, + `tagline_bg` and `tagline_fg`, an editor's status bar; dark_plus has VS + Code's blue. Without them the row keeps the tag's colours, as before. + - MuPDF and FreeType are lazy: a fresh checkout's `zig build -Dplatform=tui` fetches neither; `-Dpdf` fetches MuPDF the first time (and is on by itself after), and without it the PDF steps say so. diff --git a/src/colors.zig b/src/colors.zig index f9e5495f..cb5dbe75 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -122,6 +122,10 @@ test "every faithful port meets pardes's chrome floors in its own colours, with try std.testing.expect(contrast(th.tag_active_fg.?, th.tag_active_bg.?) >= 4.5); try std.testing.expect(contrast(th.box_dim, th.tag_bg) >= 1.5); try std.testing.expect(th.palette != null); + // A status bar of its own reads as tag text does; without one the + // tagline is the tag's. + try std.testing.expect(contrast(chrome.tagline_fg, chrome.tagline_bg) >= 4.5); + if (th.tagline_bg == null) try std.testing.expectEqual(th.tag_bg, chrome.tagline_bg); } } @@ -297,6 +301,10 @@ pub const Theme = struct { // editor palettes keep working; ChromeTheme resolves their legacy defaults. tag_active_bg: ?[3]u8 = null, tag_active_fg: ?[3]u8 = null, + /// The workspace row (the tagline): an editor's status bar in its own + /// colours, where it has them; else the tag's. + tagline_bg: ?[3]u8 = null, + tagline_fg: ?[3]u8 = null, /// Filename/output-name accent, also used by the Term command. tag_name_fg: ?[3]u8 = null, /// Active tint; absence preserves the shared name tint or active tag ink. @@ -541,6 +549,8 @@ comptime { pub const ChromeTheme = struct { tag_bg: [3]u8, tag_fg: [3]u8, + tagline_bg: [3]u8, + tagline_fg: [3]u8, tag_active_bg: [3]u8, tag_active_fg: [3]u8, tag_name_fg: [3]u8, @@ -575,6 +585,8 @@ pub const ChromeTheme = struct { return .{ .tag_bg = th.tag_bg, .tag_fg = th.tag_fg, + .tagline_bg = th.tagline_bg orelse th.tag_bg, + .tagline_fg = th.tagline_fg orelse th.tag_fg, .tag_active_bg = active_bg, .tag_active_fg = active_fg, .tag_name_fg = name_fg, @@ -739,7 +751,6 @@ pub fn finishThemeInitialization(p: *Pardes) void { p.chrome = ChromeTheme.fromTheme(p.theme()); } - /// Themes near `name`, a line of them, for a Theme given a name there is /// none of (all of them, Themes, are too many for a refused write): every /// one sharing its first letter when they fit in `buf`, else the 8 nearest. diff --git a/src/draw.zig b/src/draw.zig index b17e2458..c45f7b15 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -478,11 +478,11 @@ fn paintHeaders(p: *Pardes, s: *Surface) !void { const layer = &s.tag_layers[MAX_PANES + MAX_COLS]; var viewport = region.rect; const inset = @min(TAG_TEXT_INSET, viewport.w); - s.fill(viewport.x, viewport.y, inset, viewport.h, .{ .bg = .{ .rgb = chrome.tag_bg }, .fg = .{ .rgb = chrome.tag_fg }, .font_role = .tagline }); + s.fill(viewport.x, viewport.y, inset, viewport.h, .{ .bg = .{ .rgb = chrome.tagline_bg }, .fg = .{ .rgb = chrome.tagline_fg }, .font_role = .tagline }); viewport.x += inset; viewport.w -= inset; - try renderHeaderLayer(p, layer, .workspace, 0, viewport, tagline.topbar(p), top, chrome.tag_bg, chrome.tag_fg); - joinHeaderRows(s, layer, chrome.tag_fg); + try renderHeaderLayer(p, layer, .workspace, 0, viewport, tagline.topbar(p), top, chrome.tagline_bg, chrome.tagline_fg); + joinHeaderRows(s, layer, chrome.tagline_fg); } const column_rows = layout.columnBarHeight(p); if (column_rows > 0) for (0..p.view().ncol) |c| { @@ -1351,4 +1351,3 @@ test "a body with context rows is painted once, and the grid's rows are what a p // The layer's own rows run past the grid's. try std.testing.expect(layer.rows > body.rect.h); } - diff --git a/src/themes/dark_plus.zig b/src/themes/dark_plus.zig index 91092732..9c1cb689 100644 --- a/src/themes/dark_plus.zig +++ b/src/themes/dark_plus.zig @@ -26,6 +26,10 @@ pub const theme = .{ .tag_active_bg = .{ 0x1e, 0x1e, 0x1e }, // ~/05-genizah/vscode/src/vs/workbench/common/theme.ts:49 tab.activeForeground dark Color.white .tag_active_fg = .{ 0xff, 0xff, 0xff }, + // the tagline is the status bar: ~/05-genizah/vscode/src/vs/workbench/common/theme.ts:298 statusBar.background dark #007ACC + .tagline_bg = .{ 0x00, 0x7a, 0xcc }, + // ~/05-genizah/vscode/src/vs/workbench/common/theme.ts:289 statusBar.foreground dark #FFFFFF + .tagline_fg = .{ 0xff, 0xff, 0xff }, // the focused grip: ~/05-genizah/vscode/src/vs/platform/theme/common/colors/baseColors.ts:38 focusBorder dark .box = .{ 0x00, 0x7f, 0xd4 }, // derived: the grip at rest, the accent #007fd4 faded toward the unfocused tag #3c3c3c as far as 1.6:1 off it (0.54 of the way) -- cgit v1.3