diff options
| -rw-r--r-- | docs/typ/themes.typ | 1 | ||||
| -rw-r--r-- | src/CHANGELOG.md | 4 | ||||
| -rw-r--r-- | src/colors.zig | 13 | ||||
| -rw-r--r-- | src/draw.zig | 7 | ||||
| -rw-r--r-- | src/themes/dark_plus.zig | 4 | ||||
| -rw-r--r-- | test/snapshots/theme.golden | 2 | ||||
| -rw-r--r-- | test/snapshots/themesel.golden | 4 |
7 files changed, 27 insertions, 8 deletions
diff --git a/docs/typ/themes.typ b/docs/typ/themes.typ index ac780e95..97b42748 100644 --- a/docs/typ/themes.typ +++ b/docs/typ/themes.typ @@ -107,6 +107,7 @@ take `null`, so older files stay valid: #pairs( [`tag_active_bg`, `tag_active_fg`], [the focused pane's tag; a ground closer than 1.25:1 to `tag_bg` is pushed further the way it leans, as far as its text keeps its contrast. Absent: `tag_bg`, `tag_fg`], + [`tagline_bg`, `tagline_fg`], [the tagline, the workspace row: an editor's status bar in its own colours (`dark_plus` has VS Code's blue). Absent: the tag's], [`tag_name_fg`, `tag_active_name_fg`], [the file name's or a terminal's #word("Term") tint, in normal and focused tags. Absent: the tag's foreground], [`column_box`, `column_box_dim`], [a column's grip held (and its drag rail), and at rest. Absent: `num`; a mix of `column_box` and `tag_bg`], [`border`], [quiet separators, lifted to 1.6:1 when under 1.5:1 off the page. Absent: `scroll_track`], 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) diff --git a/test/snapshots/theme.golden b/test/snapshots/theme.golden index 8e9d49c2..c6e384c5 100644 --- a/test/snapshots/theme.golden +++ b/test/snapshots/theme.golden @@ -583,7 +583,7 @@ |30: 0-0 d,#e8c46a, 1-49 d,#0a1030, 50-50 d,#e8c46a, 51-99 d,#0a1030, == snap dark-plus grid=100x31 cursor=4,6 == style dark-plus grid=100x31 -|0: 0-1 d,#3c3c3c, 2-77 #a7a7a7,#3c3c3c, 78-86 #d4d4d4,#264f78, 87-99 #d4d4d4,#3c3c3c, +|0: 0-1 d,#007acc, 2-77 #ffffff,#007acc, 78-86 #d4d4d4,#264f78, 87-99 #d4d4d4,#007acc, |1: 0-1 d,#458276, 2-49 #ffffff,#1e1e1e, 50-51 #ffffff,#458276, 52-99 #a7a7a7,#3c3c3c, |2: 0-1 d,#007fd4, 2-28 #ffffff,#1e1e1e, 29-38 #cbe5fc,#1e1e1e, 39-49 #ffffff,#1e1e1e, 50-51 #ffffff,#1c608e, 52-78 #a7a7a7,#3c3c3c, 79-88 #68aee9,#3c3c3c, 89-99 #a7a7a7,#3c3c3c, |3: 0-1 d,#1e1e1e, 2-49 #ffffff,#1e1e1e, 50-51 #ffffff,#3c3c3c, 52-99 #a7a7a7,#3c3c3c, diff --git a/test/snapshots/themesel.golden b/test/snapshots/themesel.golden index 45fa202d..b614a33e 100644 --- a/test/snapshots/themesel.golden +++ b/test/snapshots/themesel.golden @@ -625,7 +625,7 @@ |29: 23 # Solarized |30: 24 Theme solarized_dark == style step-dark-plus grid=100x31 -|0: 0-1 d,#3c3c3c, 2-99 #a7a7a7,#3c3c3c, +|0: 0-1 d,#007acc, 2-99 #ffffff,#007acc, |1: 0-1 d,#458276, 2-99 #ffffff,#1e1e1e, |2: 0-1 d,#1c608e, 2-31 #a7a7a7,#3c3c3c, 32-37 #68aee9,#3c3c3c, 38-99 #a7a7a7,#3c3c3c, |3: 0-0 d,#424242, 1-4 d,#1e1e1e, 5-6 #858585,#1e1e1e, 7-99 #d4d4d4,#1e1e1e, @@ -705,7 +705,7 @@ |30: 0-0 d,#eee8d5, 1-3 d,#002b36, 4-6 #586e75,#002b36, 7-99 #839496,#002b36, == snap step-back grid=100x31 cursor=7,24 == style step-back grid=100x31 -|0: 0-1 d,#3c3c3c, 2-99 #a7a7a7,#3c3c3c, +|0: 0-1 d,#007acc, 2-99 #ffffff,#007acc, |1: 0-1 d,#458276, 2-99 #ffffff,#1e1e1e, |2: 0-1 d,#1c608e, 2-31 #a7a7a7,#3c3c3c, 32-37 #68aee9,#3c3c3c, 38-99 #a7a7a7,#3c3c3c, |3: 0-0 d,#424242, 1-4 d,#1e1e1e, 5-6 #858585,#1e1e1e, 7-99 #d4d4d4,#1e1e1e, |
