diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/ansi.zig | 8 | ||||
| -rw-r--r-- | core/colors.zig | 14 | ||||
| -rw-r--r-- | core/jj.zig | 194 |
3 files changed, 73 insertions, 143 deletions
diff --git a/core/ansi.zig b/core/ansi.zig index e4fbf5da..3772de43 100644 --- a/core/ansi.zig +++ b/core/ansi.zig @@ -453,15 +453,15 @@ pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, t } if (lo > hi) return; const styles = syntax.highlightDiffRows(arena, flat, lo, hi, true) catch return; - const tints: Colors.Grounds = .of(p.theme()); - const ink = p.theme().fg orelse p.theme().tag_fg; + const chrome = p.chrome(); const body_y = p.bodyTop(pane, r); shown = std.mem.splitScalar(u8, body, '\n'); for (views, 0..) |maybe, vr| { const line = shown.next() orelse break; const view = maybe orelse continue; const base = @intFromPtr(rows[view.row].ptr) - flat_start - lo; - const tint = if (base < styles.len) tints.forStyle(styles[base]) else null; + const lead: u8 = if (base < styles.len) styles[base] else 0; + const tint: ?Colors.Chrome.Diff = if (lead & syntax.ground_add != 0) chrome.add else if (lead & syntax.ground_del != 0) chrome.del else null; if (tint) |t| s.tint(tx, body_y + @as(u16, @intCast(vr)), tw, t.row, null); var c: usize = 0; var screen_c: usize = 0; @@ -478,7 +478,7 @@ pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, t else if (panes.File.synStyle(p, @fromBackingInt(@intCast(style & syntax.syn_bits)))) |ss| ss else if (tint != null) - .{ .fg = ink, .bold = false } + .{ .fg = chrome.page.text, .bold = false } else null; if (paint) |ss| { diff --git a/core/colors.zig b/core/colors.zig index eefb2b67..4e4bd9ba 100644 --- a/core/colors.zig +++ b/core/colors.zig @@ -791,6 +791,11 @@ pub const Chrome = struct { // R10: the lanes (the accents but green and red, hue-sorted) and // churn's steps from the line numbers' ink to the deleted hue. c.lanes_len = lanesOf(.{ ansi[3], ansi[4], ansi[5], ansi[6], th.number, th.keyword }, .{ th.deleted orelse ansi[1], th.added orelse ansi[2] }, &c.lanes); + // A theme with no accent (a grey one) draws its lanes in one grey. + if (c.lanes_len == 0) { + c.lanes[0] = c.line_number; + c.lanes_len = 1; + } for (&c.heat, 1..) |*h, k| h.* = mixOklab(c.line_number, th.deleted orelse ansi[1], @as(f32, @floatFromInt(k)) / 8); return c; } @@ -2602,7 +2607,14 @@ fn ringFailures(th: *const Theme, c: *const Chrome) std.EnumSet(RingCheck) { f.setPresent(.severities4, apart4 < Chrome.severity_apart); const err = lch(c.page.severity[0]); f.setPresent(.error_red, !(err[1] >= 0.08 and (err[2] <= 50 or err[2] >= 330))); - f.setPresent(.diff, @min(contrast(c.add.row, page), contrast(c.del.row, page)) < 1.1 or de(c.add.row, c.del.row) < 0.05); + // R10: each diff row 1.15:1 off the page, unless the text holds it + // nearer (never under its floor there: tokyonight_day's text, 4.9:1, + // leaves 1.11:1), and the two 0.05 apart. + const diff_floor = @min(4.5, text * 0.9); + for ([2][3]u8{ c.add.row, c.del.row }) |row| { + if (contrast(row, page) < Chrome.row_step - 0.005 and contrast(ink, row) > diff_floor + 0.05) f.insert(.diff); + } + if (de(c.add.row, c.del.row) < 0.05) f.insert(.diff); var ansi_least: f32 = 21; for (c.ansi[1..], 1..) |a, i| { ansi_least = @min(ansi_least, contrast(a, page)); diff --git a/core/jj.zig b/core/jj.zig index 63488b8c..e9b8edd1 100644 --- a/core/jj.zig +++ b/core/jj.zig @@ -1942,9 +1942,9 @@ fn ghostLanes(ch: *const Changes, ghosts: []const Ghost, gi: usize, first_row: b /// a changed line's old text grey, the words that went red; a /// description's id and title in its lane's colour `lane`, or with one /// change pinned (no one colour a lane) its id in the theme's keyword ink, -/// its author and age grey. +/// its author and age grey. All of them the chrome's (Chrome.add, .del). fn inkGhost(p: *Pardes, s: *pardes.Surface, pane: *const Pane, g: Ghost, row: i32, from: usize, to: usize, pad: i32, marks: []const [2]u32, lane: ?[3]u8, x: u16, y: u16, w: u16) void { - const th = p.theme(); + const chrome = p.chrome(); const tab = p.settings.tab; const said = File.sourceLine(pane, row); const Ink = struct { @@ -1975,13 +1975,13 @@ fn inkGhost(p: *Pardes, s: *pardes.Surface, pane: *const Pane, g: Ghost, row: i3 const ink: Ink = .{ .q = p, .s = s, .pane = pane, .row = row, .from = from, .to = to, .pad = pad, .x = x, .y = y, .w = w }; _ = tab; switch (g.kind) { - .deleted => s.tint(x, y, w, pardes.colors.Grounds.of(th).del.row, th.lineno), - .added => s.tint(x, y, w, pardes.colors.Grounds.of(th).add.row, null), + .deleted => s.tint(x, y, w, chrome.del.row, chrome.line_number), + .added => s.tint(x, y, w, chrome.add.row, null), .changed => { - ink.fg(0, said.len, th.lineno); + ink.fg(0, said.len, chrome.line_number); for (marks[g.marks..][0..g.nmarks]) |m| { const c = ink.cells(m[0], m[1]); - if (c[0] < c[1]) s.tint(x + c[0], y, c[1] - c[0], pardes.colors.Grounds.of(th).del.emph, null); + if (c[0] < c[1]) s.tint(x + c[0], y, c[1] - c[0], chrome.del.emph, null); } }, .description => { @@ -1989,8 +1989,8 @@ fn inkGhost(p: *Pardes, s: *pardes.Surface, pane: *const Pane, g: Ghost, row: i3 // title) in the lane's colour, the author and the age grey. const id_end = std.mem.indexOfScalar(u8, said, ' ') orelse said.len; const author = @min(g.author, said.len); - ink.fg(0, if (lane != null) author else id_end, lane orelse th.kw); - ink.fg(author, said.len, th.lineno); + ink.fg(0, if (lane != null) author else id_end, lane orelse chrome.syntax[@intFromEnum(syntax.Syn.keyword)]); + ink.fg(author, said.len, chrome.line_number); }, } } @@ -2010,7 +2010,7 @@ fn inkCame(p: *Pardes, s: *pardes.Surface, pane: *Pane, marks: []const [2]u32, r if (lo >= hi) continue; const from = here.pad + File.displayOffset(tab, pane, row, @intCast(first), @intCast(lo)); const to = @min(@as(i32, w), here.pad + File.displayOffset(tab, pane, row, @intCast(first), @intCast(hi))); - if (from >= 0 and from < to) s.tint(x + @as(u16, @intCast(from)), y, @intCast(to - from), pardes.colors.Grounds.of(p.theme()).add.emph, null); + if (from >= 0 and from < to) s.tint(x + @as(u16, @intCast(from)), y, @intCast(to - from), p.chrome().add.emph, null); } } @@ -2245,82 +2245,6 @@ fn nest(lines: []Line, npins: usize) void { } } -/// A diff's two inks (one change pinned, `paintLanes`): its lane's colour -/// says the kind of the row it stands beside (the user's rulings of -/// 2026-11-23), `added` beside a row it wrote (a line added whole, a changed -/// line's new text), `taken` beside a row it took away (a line taken away, a -/// changed line's old text). -pub const Inks = struct { added: [3]u8, taken: [3]u8 }; - -/// The diff's own two colours: the theme's green and its red (the grounds' -/// and the changed words' hues), each pushed toward the ink until it reads -/// 3:1 on the page (or nearly as the ink does, where the ink reads less). -pub fn laneInks(th: *const pardes.LegacyTheme) Inks { - var inks: [2][3]u8 = .{ if (th.palette) |c| c[2] else .{ 0x2e, 0xa0, 0x43 }, themeRed(th) }; - const page = th.bg orelse th.tag_bg; - for (&inks) |*ink| { - var step: usize = 0; - while (step < 8 and pardes.colors.contrast(ink.*, page) < 3) : (step += 1) ink.* = pardes.colors.mixOklab(ink.*, th.fg orelse th.tag_fg, 0.4); - } - return .{ .added = inks[0], .taken = inks[1] }; -} - -/// The lanes' colours, a pin's the `pin % len`th, oldest first: the -/// theme's accents but the two that mean written and taken away (its green -/// and red), in hue order from the top, each a hue `hue_apart` or more from -/// the one kept before it (doom one: magenta, blue, yellow; cyan and -/// orange go). Distinct colours, never one between two. -pub fn laneColours(th: *const pardes.LegacyTheme, buf: *[8][3]u8) []const [3]u8 { - const pal = th.palette; - const grounds = [2][3]u8{ themeRed(th), if (pal) |c| c[2] else .{ 0x2e, 0xa0, 0x43 } }; - const accents: [6][3]u8 = if (pal) |c| .{ c[3], c[4], c[5], c[6], th.num, th.kw } else .{ th.kw, th.num, th.str, th.box, th.column_box orelse th.box, th.comment }; - var sorted: [6][3]u8 = undefined; - var n: usize = 0; - for (accents) |c| { - // A grey is no accent; one near written or taken away means that. - if (chroma(c) < 48 or hueApart(c, grounds[0]) < hue_apart or hueApart(c, grounds[1]) < hue_apart) continue; - sorted[n] = c; - n += 1; - } - std.sort.insertion([3]u8, sorted[0..n], {}, struct { - fn above(_: void, a: [3]u8, b: [3]u8) bool { - return hue(a) > hue(b); - } - }.above); - var kept: usize = 0; - for (sorted[0..n]) |c| { - if (kept > 0 and hueApart(c, buf[kept - 1]) < hue_apart) continue; - buf[kept] = c; - kept += 1; - } - return buf[0..kept]; -} - -/// Two hues closer than this are one colour to a lane (doom one's cyan is -/// 12 degrees from its blue, its orange 11 from its yellow). -const hue_apart = 15; - -fn chroma(c: [3]u8) u8 { - return @max(c[0], c[1], c[2]) - @min(c[0], c[1], c[2]); -} - -/// HSV's hue, in degrees. -fn hue(c: [3]u8) f32 { - const r: f32 = @floatFromInt(c[0]); - const g: f32 = @floatFromInt(c[1]); - const b: f32 = @floatFromInt(c[2]); - const hi = @max(r, g, b); - const d = hi - @min(r, g, b); - if (d == 0) return 0; - const h = if (hi == r) @mod((g - b) / d, 6) else if (hi == g) (b - r) / d + 2 else (r - g) / d + 4; - return 60 * h; -} - -fn hueApart(a: [3]u8, b: [3]u8) f32 { - const d = @abs(hue(a) - hue(b)); - return @min(d, 360 - d); -} - /// The pane's pinned changes as a view shows them, on its body's rows (body_layer.zig, while /// File.Layers.lanes is set): in the gutter's lane cells after the number a /// lane each pin whose block runs down the row, at its level, a glyph in a @@ -2333,18 +2257,13 @@ pub fn paint(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u1 if (pane.layers.lanes > 0) paintLanes(p, s, pane, r, tx, tw, body_h); } -/// The theme's red: what a change took away; churn's top. -pub fn themeRed(th: *const pardes.LegacyTheme) [3]u8 { - return if (th.palette) |c| c[1] else .{ 0xcf, 0x22, 0x2e }; -} - -/// A count's colour on churn's gradient: smooth from the line numbers' -/// grey to the theme's red, on a log scale of the count against the -/// hottest; null for none. -fn heatColour(th: *const pardes.LegacyTheme, count: u16, hottest: u16) ?[3]u8 { +/// A count's colour on churn's eight steps from the line numbers' grey to +/// the deleted hue (Chrome.heat, worked out with the theme), on a log scale +/// of the count against the hottest; null for none. +fn heatColour(c: *const pardes.colors.Chrome, count: u16, hottest: u16) ?[3]u8 { if (count == 0 or hottest == 0) return null; const t = @log(@as(f32, @floatFromInt(count)) + 1) / @log(@as(f32, @floatFromInt(hottest)) + 1); - return pardes.colors.mixOklab(th.lineno, themeRed(th), t); + return c.heat[@min(c.heat.len, @as(usize, @intFromFloat(@ceil(t * c.heat.len)))) -| 1]; } /// The heat lane: a cell after the line number (before the changes' @@ -2362,7 +2281,7 @@ fn paintHeat(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u1 if (row < 0 or File.readOnlyRow(f, @intCast(row)) != null) continue; const line = File.fileRow(f, @intCast(row)); if (line >= heat.lines.len) continue; - const rgb = heatColour(p.theme(), heat.lines[line], heat.hottest) orelse continue; + const rgb = heatColour(p.chrome(), heat.lines[line], heat.hottest) orelse continue; var style = s.at(x, body_y + vr).style; style.fg = .{ .rgb = rgb }; s.set(x, body_y + vr, "\u{258c}", style); @@ -2380,7 +2299,7 @@ pub fn railHeat(p: *Pardes, s: *pardes.Surface, pane: *Pane, id: usize, rail: pa for (0..rail.h) |row| { const lo = row * total / rail.h; const hi = @max(lo + 1, (row + 1) * total / rail.h); - const rgb = heatColour(p.theme(), std.mem.max(u16, heat.lines[lo..@min(hi, total)]), heat.hottest) orelse continue; + const rgb = heatColour(p.chrome(), std.mem.max(u16, heat.lines[lo..@min(hi, total)]), heat.hottest) orelse continue; if (p.view().frontend.windowed) s.heat.append(p.gpa, .{ .owner = @intCast(id), .row = @intCast(row), .rgb = rgb }) catch {} else @@ -2393,18 +2312,18 @@ fn paintLanes(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u const ch = answered(p, f.layer.owner) orelse return; if (ch.lines.len == 0) return; const tab = p.settings.tab; - var buf: [8][3]u8 = undefined; - const colours = laneColours(p.theme(), &buf); - if (colours.len == 0) return; - // One change pinned is a diff: its lane in the diff's own two colours, - // by the row's kind; several, a colour a change, to tell them apart. - const one: ?Inks = if (ch.pins.len == 1) laneInks(p.theme()) else null; + const chrome = p.chrome(); + const colours = chrome.lanes[0..chrome.lanes_len]; + // One change pinned is a diff: its lane in the diff's own two markers + // (the user's rulings of 2026-11-23: added beside a row it wrote, deleted + // beside one it took away); several, a colour a change, to tell them + // apart. + const one = ch.pins.len == 1; const gutter = File.gutterWidth(pane); const cells = File.laneCells(pane); if (gutter >= tw or cells == 0) return; const first = tx + gutter - cells; const windowed = p.view().frontend.windowed; - const ground = pardes.colors.Grounds.of(p.theme()).add.row; const body_y = p.bodyTop(pane, r); const nrows = File.lineCount(f.content); var vr: u16 = pane.context_rows; @@ -2424,7 +2343,7 @@ fn paintLanes(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u const next = pane.wrapAt(tab, @as(i32, vr) + 1); const to: usize = if (next.line == w.line) @intCast(next.at) else File.sourceLine(pane, w.line).len; const first_row = w.at <= 0; - inkGhost(p, s, pane, g, w.line, @intCast(@max(0, w.at)), to, w.pad, ch.marks, if (one == null) colours[g.pin % colours.len] else null, tx + gutter, y, tw - gutter); + inkGhost(p, s, pane, g, w.line, @intCast(@max(0, w.at)), to, w.pad, ch.marks, if (one) null else colours[g.pin % colours.len], tx + gutter, y, tw - gutter); if (g.kind == .description and first_row) points = @enumFromInt(g.pin); taken = g.kind == .deleted or g.kind == .changed or (g.kind == .description and takenAbove(ch.ghosts, gi)); break :ghost ghostLanes(ch, ch.ghosts, gi, first_row); @@ -2432,9 +2351,9 @@ fn paintLanes(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u const at = File.fileRow(f, row); if (at >= ch.lines.len) continue; const line = ch.lines[at]; - if (line.whole and line.pin != .none) s.tint(tx + gutter, y, tw - gutter, ground, null); + if (line.whole and line.pin != .none) s.tint(tx + gutter, y, tw - gutter, chrome.add.row, null); // Going: a pin ahead takes it away. - if (line.going != .none) s.tint(tx + gutter, y, tw - gutter, pardes.colors.Grounds.of(p.theme()).del.row, null); + if (line.going != .none) s.tint(tx + gutter, y, tw - gutter, chrome.del.row, null); taken = line.going != .none; if (!line.whole and line.nmarks > 0) inkCame(p, s, pane, ch.marks[line.marks..][0..line.nmarks], w.line, vr, tx + gutter, y, tw - gutter); break :line line.lanes; @@ -2442,7 +2361,7 @@ fn paintLanes(p: *Pardes, s: *pardes.Surface, pane: *Pane, r: pardes.Rect, tx: u for (lanes, 0..) |lane, level| { if (lane == .none) break; const arrow = lane == points; - const rgb = if (one) |d| (if (taken) d.taken else d.added) else colours[@intFromEnum(lane) % colours.len]; + const rgb = if (one) (if (taken) chrome.del.ink else chrome.add.ink) else colours[@intFromEnum(lane) % colours.len]; if (windowed) { // A body a pixel shell draws as a layer is painted on a // temporary surface first: its lanes are not drawn yet. @@ -2877,10 +2796,10 @@ test "Changes draws a lane a pinned change after the line number, nested ones a const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const first = body.x + before; - var buf: [8][3]u8 = undefined; - const colours = laneColours(p.theme(), &buf); + const c = p.chrome(); + const colours = c.lanes[0..c.lanes_len]; try testing.expect(colours.len >= 3); - const ground = pardes.colors.Grounds.of(p.theme()).add.row; + const ground = c.add.row; // Lines 1-10, each on the row the view draws it at (ghost rows // stand between): `fn`'s spine on all; `mid` on 3-6; `shift` on 4. const want = [_][]const u8{ "0", "0", "01", "012", "01", "01", "0", "0", "0", "0" }; @@ -2917,16 +2836,15 @@ test "Changes draws a lane a pinned change after the line number, nested ones a } } -test "a diff's two lane inks in every theme: its green and its red, never one colour, each read on the page" { - for (&pardes.colors.legacy_themes) |*th| { - const inks = laneInks(th); - errdefer std.debug.print("{s}: added {any} taken {any}\n", .{ th.name, inks.added, inks.taken }); - try testing.expect(!std.meta.eql(inks.added, inks.taken)); - const page = th.bg orelse th.tag_bg; - // 3:1, or as near the theme's own ink's as it reads (hex_poison's). - const floor = @min(3, pardes.colors.contrast(th.fg orelse th.tag_fg, page)) - 0.1; - try testing.expect(pardes.colors.contrast(inks.added, page) >= floor); - try testing.expect(pardes.colors.contrast(inks.taken, page) >= floor); +test "a diff's two lane inks in every theme are its added and deleted markers (DESIGN.md R10): never one colour, each 4.5:1 on its rows, as near as the theme reaches" { + for (&pardes.colors.themes) |*th| { + const c: pardes.colors.Chrome = .of(th); + errdefer std.debug.print("{s}: added {any} deleted {any}\n", .{ th.name, c.add, c.del }); + try testing.expect(!std.meta.eql(c.add.ink, c.del.ink)); + for ([2]pardes.colors.Chrome.Diff{ c.add, c.del }) |d| for ([2][3]u8{ d.row, d.emph }) |ground| { + const reach = @max(pardes.colors.contrast(@splat(255), ground), pardes.colors.contrast(@splat(0), ground)); + try testing.expect(pardes.colors.contrast(d.ink, ground) >= @min(4.5, reach) - 0.01); + }; } } @@ -3003,9 +2921,8 @@ test "Changes draws what the text has not where it stood, as ghost rows: a line const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const first = body.x + File.gutterWidth(pane) - File.laneCells(pane); - var cbuf: [8][3]u8 = undefined; - const colours = laneColours(p.theme(), &cbuf); - const grounds = pardes.colors.Grounds.of(p.theme()); + const grounds = p.chrome(); + const colours = grounds.lanes[0..grounds.lanes_len]; const lanes = [_][]const u8{ "0", "0", "02", "02", "02", "02", "01", "01", "01", "0", "0", "0" }; const Ground = enum { none, add, del }; const ground = [_]Ground{ .add, .add, .none, .none, .add, .none, .del, .del, .none, .add, .add, .none }; @@ -3048,7 +2965,7 @@ test "Changes draws what the text has not where it stood, as ghost rows: a line try testing.expectEqual(pardes.Color{ .rgb = colours[pin] }, s.at(body.x + File.gutterWidth(pane), body.y + row).style.fg); try testing.expectEqual(pardes.Color{ .rgb = colours[pin] }, s.at(body.x + File.gutterWidth(pane) + 5, body.y + row).style.fg); } - try testing.expectEqual(pardes.Color{ .rgb = p.theme().lineno }, s.at(body.x + File.gutterWidth(pane) + 4, body.y + 6).style.fg); + try testing.expectEqual(pardes.Color{ .rgb = grounds.line_number }, s.at(body.x + File.gutterWidth(pane) + 4, body.y + 6).style.fg); // The changed line: on its old text the word that went (`b`) red, // on it the word that came (`b2`) green; the rest of each neither. const text_x = body.x + File.gutterWidth(pane); @@ -3071,10 +2988,9 @@ test "Changes draws what the text has not where it stood, as ghost rows: a line const s1 = try p.render(arena.allocator()); const top = s1.region(.body, id).?.rect.y; const at = body.x + File.gutterWidth(pane) - File.laneCells(pane); - const inks = laneInks(p.theme()); - try testing.expect(!std.meta.eql(inks.added, inks.taken)); + try testing.expect(!std.meta.eql(grounds.add.ink, grounds.del.ink)); for ([_]u16{ 2, 3, 4, 5 }, [_]bool{ true, false, false, false }) |row, red| { - const ink = if (red) inks.taken else inks.added; + const ink = if (red) grounds.del.ink else grounds.add.ink; if (windowed) { var n: usize = 0; for (s1.lanes.items) |lane| if (lane.y == top + row) { @@ -3084,8 +3000,9 @@ test "Changes draws what the text has not where it stood, as ghost rows: a line try testing.expectEqual(@as(usize, 1), n); } else try testing.expectEqual(pardes.Color{ .rgb = ink }, s1.at(at, top + row).style.fg); } - try testing.expectEqual(pardes.Color{ .rgb = p.theme().kw }, s1.at(text_x, top + 5).style.fg); - try testing.expect(!std.meta.eql(pardes.Color{ .rgb = p.theme().kw }, s1.at(text_x + 5, top + 5).style.fg)); + const keyword = grounds.syntax[@intFromEnum(syntax.Syn.keyword)]; + try testing.expectEqual(pardes.Color{ .rgb = keyword }, s1.at(text_x, top + 5).style.fg); + try testing.expect(!std.meta.eql(pardes.Color{ .rgb = keyword }, s1.at(text_x + 5, top + 5).style.fg)); } } @@ -3299,12 +3216,12 @@ test "a description is whole, its title and its author never cut: in a pane narr const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const x = body.x + File.gutterWidth(pane); - try testing.expectEqual(pardes.Color{ .rgb = p.theme().kw }, s.at(x, body.y + 3).style.fg); + try testing.expectEqual(pardes.Color{ .rgb = p.chrome().syntax[@intFromEnum(syntax.Syn.keyword)] }, s.at(x, body.y + 3).style.fg); const last: u16 = body.y + 3 + @as(u16, @intCast(n - 1)); const end = x + @as(u16, @intCast(File.displayWidth(p.settings.tab, Ghosts.text(pane, got[3 + n - 1])))) - 1; try testing.expectEqualStrings("w", s.at(end, last).grapheme()); - try testing.expectEqual(pardes.Color{ .rgb = p.theme().lineno }, s.at(end, last).style.fg); - try testing.expectEqual(pardes.Color{ .rgb = p.theme().lineno }, s.at(end - 4, last).style.fg); + try testing.expectEqual(pardes.Color{ .rgb = p.chrome().line_number }, s.at(end, last).style.fg); + try testing.expectEqual(pardes.Color{ .rgb = p.chrome().line_number }, s.at(end - 4, last).style.fg); const first = x - File.laneCells(pane); for (0..n) |k| { const y = body.y + 3 + @as(u16, @intCast(k)); @@ -4068,7 +3985,7 @@ test "from the middle: in a revision's pane a pin behind it shows the lines it t const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const x = body.x + File.gutterWidth(pane) + 1; - const grounds = pardes.colors.Grounds.of(p.theme()); + const grounds = p.chrome(); for ([_]u16{ 1, 8 }) |row| try testing.expectEqual(pardes.Color{ .rgb = grounds.add.row }, s.at(x, body.y + row).style.bg); for ([_]u16{ 7, 11 }) |row| try testing.expectEqual(pardes.Color{ .rgb = grounds.del.row }, s.at(x, body.y + row).style.bg); } @@ -4255,8 +4172,10 @@ test "Churn counts the changes that touched each declaration and draws them afte const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const x = body.x + File.gutterWidth(pane) - 1; - const red = themeRed(p.theme()); - const warm = pardes.colors.mixOklab(p.theme().lineno, red, @log(3.0) / @log(4.0)); + // Churn's steps (Chrome.heat): the hottest the last, f's 3 of 4's + // log, the seventh. + const red = p.chrome().heat[7]; + const warm = p.chrome().heat[6]; for (0..7) |row| { const cell = s.at(x, body.y + @as(u16, @intCast(row))); if (row == 3) { @@ -4465,8 +4384,7 @@ test "Compare pins the whole difference between each two points as one change: t const s = try p.render(arena.allocator()); const body = s.region(.body, id).?.rect; const first = body.x + File.gutterWidth(pane) - File.laneCells(pane); - var cbuf: [8][3]u8 = undefined; - const colours = laneColours(p.theme(), &cbuf); + const colours = p.chrome().lanes[0..p.chrome().lanes_len]; for ([_]u16{ 3, 7, 8 }, [_]usize{ 0, 1, 1 }) |row, pin| { if (windowed) { var n: usize = 0; |
