diff options
Diffstat (limited to 'core/colors.zig')
| -rw-r--r-- | core/colors.zig | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/core/colors.zig b/core/colors.zig index 6c83f5c8..7be5f008 100644 --- a/core/colors.zig +++ b/core/colors.zig @@ -604,7 +604,9 @@ pub const Chrome = struct { severity: [4][3]u8, selection: Selection, }; - pub const Selection = struct { ground: [3]u8, text: [3]u8, dim: [3]u8 }; + /// A selection on a ground, and that ground halfway to it (OKLab): a + /// second range, a hovered word (B5). + pub const Selection = struct { ground: [3]u8, text: [3]u8, dim: [3]u8, secondary: [3]u8 }; pub const Ground = enum(u1) { plain, focus }; pub const Severity = enum(u2) { @"error", warning, info, hint }; /// A diff's rows: a row's ground, its changed words', a faint line's, @@ -612,8 +614,16 @@ pub const Chrome = struct { pub const Diff = struct { row: [3]u8, emph: [3]u8, line: [3]u8, ink: [3]u8 }; /// The grips: focused, its ring at rest, a reading pane's mark (its /// ring; a terminal's cell) and that mark as a glyph on a focused grip, - /// unsaved, a column's grabbed and at rest, and the ink on any fill. - pub const Grip = struct { focus: [3]u8, ring: [3]u8, mode: [3]u8, mode_glyph: [3]u8, dirty: [3]u8, column: [3]u8, column_rest: [3]u8, ink: [3]u8 }; + /// unsaved, a column's grabbed and at rest, the ink on any fill, and a + /// message's mark on each fill a pane's grip has in a grid (`Fill`). + pub const Grip = struct { focus: [3]u8, ring: [3]u8, mode: [3]u8, mode_glyph: [3]u8, dirty: [3]u8, column: [3]u8, column_rest: [3]u8, ink: [3]u8, marks: [4]Marks }; + /// A pane's grip in a grid, a cell: focused, unsaved (its second cell), + /// at rest its ring, a reading pane's its mode's mark (R5', R6). + pub const Fill = enum(u2) { focus, dirty, ring, mode }; + /// A message's mark on a fill (Messages.inkOn): the severities and the + /// dim ink held there; at rest and reading on the plain tag too, where + /// a window draws those grips hollow (gui.zig gripFill). + pub const Marks = struct { severity: [4][3]u8, dim: [3]u8 }; // The floors (B4's table). pub const text_floor: f32 = 4.5; @@ -777,6 +787,12 @@ pub const Chrome = struct { c.grip.column_rest = towardOf(hold(column, &.{page}, ring_floor), page, ring_floor); const fills = [5][3]u8{ c.grip.focus, c.grip.dirty, c.grip.column, c.grip.column_rest, c.grip.mode }; c.grip.ink = hold(if (leastContrast(page, &fills) >= leastContrast(tag_text, &fills)) page else tag_text, &fills, text_floor); + for (&c.grip.marks, [4][3]u8{ c.grip.focus, c.grip.dirty, c.grip.ring, c.grip.mode }, 0..) |*marks, fill, i| { + const both = [2][3]u8{ fill, tag }; + const grounds_of = if (i < @intFromEnum(Fill.ring)) both[0..1] else both[0..]; + for (&marks.severity, c.tag[0].severity) |*ink, own| ink.* = hold(own, grounds_of, text_floor); + marks.dim = hold(c.tag[0].dim, grounds_of, dim_floor); + } // R10: added and deleted. c.add = diffOf(page, text, th.added orelse ansi[2], dark); @@ -995,6 +1011,7 @@ fn groundInks(th: *const Theme, ground: [3]u8, text: [3]u8, sel: [3]u8, sel_text .ground = sel, .text = sel_text, .dim = towardOf(sel_text, sel, Chrome.dim_floor), + .secondary = mixOklab(ground, sel, 0.5), }, }; } |
