feat: use solid alpha dimmed background color for highlight column
This commit is contained in:
parent
a9b902ab6c
commit
376ca8c9fc
4 changed files with 42 additions and 38 deletions
|
@ -76,10 +76,18 @@ pub fn columns(self: *const Cell) usize {
|
|||
}
|
||||
|
||||
pub fn dim(self: *Cell, alpha: u8) void {
|
||||
self.cell.style.fg = apply_alpha_value(self.cell.style.fg, alpha);
|
||||
self.dim_fg(alpha);
|
||||
self.dim_bg(alpha);
|
||||
}
|
||||
|
||||
pub fn dim_bg(self: *Cell, alpha: u8) void {
|
||||
self.cell.style.bg = apply_alpha_value(self.cell.style.bg, alpha);
|
||||
}
|
||||
|
||||
pub fn dim_fg(self: *Cell, alpha: u8) void {
|
||||
self.cell.style.fg = apply_alpha_value(self.cell.style.fg, alpha);
|
||||
}
|
||||
|
||||
fn apply_alpha_value(c: vaxis.Cell.Color, a: u8) vaxis.Cell.Color {
|
||||
var rgb = if (c == .rgb) c.rgb else return c;
|
||||
rgb[0] = @intCast((@as(u32, @intCast(rgb[0])) * a) / 256);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue