diff options
Diffstat (limited to 'core/colors.zig')
| -rw-r--r-- | core/colors.zig | 14 |
1 files changed, 13 insertions, 1 deletions
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)); |
