diff --git a/src/Grid.zig b/src/Grid.zig index 9b5f2d1b7..b048ac8a1 100644 --- a/src/Grid.zig +++ b/src/Grid.zig @@ -520,6 +520,9 @@ pub fn updateCell( }; if (self.cells.items.len + needed > self.cells.capacity) return false; + // Alpha multiplier + const alpha: u8 = if (cell.attrs.faint) 175 else 255; + // If the cell has a background, we always draw it. if (colors.bg) |rgb| { var mode: GPUCellMode = .bg; @@ -542,7 +545,7 @@ pub fn updateCell( .bg_r = rgb.r, .bg_g = rgb.g, .bg_b = rgb.b, - .bg_a = 0xFF, + .bg_a = alpha, }); } @@ -577,7 +580,7 @@ pub fn updateCell( .fg_r = colors.fg.r, .fg_g = colors.fg.g, .fg_b = colors.fg.b, - .fg_a = 255, + .fg_a = alpha, .bg_r = 0, .bg_g = 0, .bg_b = 0, @@ -602,7 +605,7 @@ pub fn updateCell( .fg_r = colors.fg.r, .fg_g = colors.fg.g, .fg_b = colors.fg.b, - .fg_a = 255, + .fg_a = alpha, .bg_r = 0, .bg_g = 0, .bg_b = 0, diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index f105cb740..976d0c070 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -301,6 +301,10 @@ pub fn setAttribute(self: *Terminal, attr: sgr.Attribute) !void { self.screen.cursor.pen.attrs.bold = true; }, + .faint => { + self.screen.cursor.pen.attrs.faint = true; + }, + .underline => { self.screen.cursor.pen.attrs.underline = true; }, diff --git a/src/terminal/sgr.zig b/src/terminal/sgr.zig index 0aa1b9b19..5c852e4e9 100644 --- a/src/terminal/sgr.zig +++ b/src/terminal/sgr.zig @@ -21,6 +21,9 @@ pub const Attribute = union(enum) { /// Bold the text. bold: void, + /// Faint/dim text. + faint: void, + /// Underline the text underline: void, @@ -88,6 +91,8 @@ pub const Parser = struct { 1 => return Attribute{ .bold = {} }, + 2 => return Attribute{ .faint = {} }, + 4 => return Attribute{ .underline = {} }, 5 => return Attribute{ .blink = {} },