summaryrefslogtreecommitdiff
path: root/src/draw.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-23 11:12:56 -0300
committerGabriel Schneider <[email protected]>2026-10-23 17:10:58 -0300
commita53a1aafb9804e943bdcd720c2bb688ecb90a888 (patch)
tree197ee0ac4106037d49c5c9fc7a2b6be4186173bf /src/draw.zig
parenta0d367b6c54ff29737662fd7cf5a78d4d183cb20 (diff)
downloadpardes-a53a1aafb9804e943bdcd720c2bb688ecb90a888.tar.gz
pardes-a53a1aafb9804e943bdcd720c2bb688ecb90a888.zip
Audit (colours, drawing): one Surface.tint, shared colour maths, the helix copies of hand-ported themes removed
The 22 <name>_helix themes that duplicate a hand-written port are gone; monokai, ayu_dark and nord stay, since others inherit from them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/draw.zig')
-rw-r--r--src/draw.zig25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/draw.zig b/src/draw.zig
index 3d0d4d3c..93a78090 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -35,8 +35,6 @@ const wordBoundsAtCol = pardes.wordBoundsAtCol;
const BOX_H = pardes.BOX_H;
const TAG_GAP = pardes.TAG_GAP;
const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET;
-const TOPBAR_H = pardes.TOPBAR_H;
-const COLBAR_H = pardes.COLBAR_H;
const MAX_PANES = pardes.MAX_PANES;
const MAX_COLS = pardes.MAX_COLS;
const MAX_TAG_ROWS = pardes.MAX_TAG_ROWS;
@@ -1213,12 +1211,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r
// Window mode (layout.windowKey): the outlined pane's tag in the
// selection's colours.
if (p.window_pick == id) {
- const th = p.theme();
- for (storage) |*cell| {
- cell.style.bg = .{ .rgb = th.sel_bg };
- cell.style.fg = .{ .rgb = th.sel_fg };
- cell.default = false;
- }
+ for (0..rows) |row| temporary.tint(0, @intCast(row), temporary.cols, p.theme().sel_bg, p.theme().sel_fg);
}
const tag_fg: Color = .{ .rgb = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg };
// One layer, a row to each line the tag shows.
@@ -1268,11 +1261,11 @@ fn joinNotice(p: *Pardes, s: *Surface, arena: std.mem.Allocator, region: Region)
// cannot move it by less than a row, a pixel shell slides it too.
const motion: Messages.MessageMotion = if (Messages.noticeLife(pane, i)) |life| Messages.messageMotion(p, life) else .{};
const page = th.bg orelse chrome.tag_bg;
- const bg = Messages.blendRgb(chrome.tag_bg, page, motion.alpha);
+ const bg = colors.lerp(page, chrome.tag_bg, motion.alpha);
// Where an exec was sent to a REPL reads in the tag's name tint, set
// apart from what the editor says.
const ink = if (kind == .message and pane.msg_sent) chrome.tag_name_fg else chrome.tag_fg;
- const fg = Messages.blendRgb(ink, page, motion.alpha);
+ const fg = colors.lerp(page, ink, motion.alpha);
// Nothing to say, or too narrow for a layer: a blank chip on the grid.
if (text.len == 0 or r.w <= TAG_TEXT_INSET) {
s.fill(region.rect.x, region.rect.y, chip, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline });
@@ -1428,15 +1421,9 @@ pub fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pa
const line = lines[row - top];
const from = if (row == first.row) first.col else 0;
const to = @min(line.len, if (row == last.row) last.col else line.len);
- var col = panes.File.rawDisplayCol(line, from) -| pane.tag_scroll;
- const end = panes.File.rawDisplayCol(line, to);
- const y = tag_y + @as(u16, @intCast(row - top));
- while (col + pane.tag_scroll < end and col < tw) : (col += 1) {
- const cell = s.at(tx + @as(u16, @intCast(col)), y);
- cell.default = false;
- cell.style.bg = .{ .rgb = th.tag_sel_bg orelse th.sel_bg };
- cell.style.fg = .{ .rgb = th.sel_fg };
- }
+ const col = panes.File.rawDisplayCol(line, from) -| pane.tag_scroll;
+ const end = @min(panes.File.rawDisplayCol(line, to) -| pane.tag_scroll, tw);
+ if (col < end) s.tint(tx + @as(u16, @intCast(col)), tag_y + @as(u16, @intCast(row - top)), @intCast(end - col), th.tag_sel_bg orelse th.sel_bg, th.sel_fg);
}
}
}