Add theme customizer.
This commit is contained in:
+8
-8
@@ -942,7 +942,7 @@ fn render(self: *Terminal, cr: *cairo.Context, _: c_int, _: c_int) !void {
|
||||
// Background. The pane frame around us clips to its own rounded corners,
|
||||
// so this just fills.
|
||||
const default_bg: theme.Rgb = if (term.colors.background.get()) |c|
|
||||
.from(c)
|
||||
.fromVt(c)
|
||||
else
|
||||
theme.bg();
|
||||
{
|
||||
@@ -952,7 +952,7 @@ fn render(self: *Terminal, cr: *cairo.Context, _: c_int, _: c_int) !void {
|
||||
}
|
||||
|
||||
const default_fg: theme.Rgb = if (term.colors.foreground.get()) |c|
|
||||
.from(c)
|
||||
.fromVt(c)
|
||||
else
|
||||
theme.fg();
|
||||
|
||||
@@ -1133,7 +1133,7 @@ fn drawCursor(
|
||||
const x = pad + @as(f64, @floatFromInt(cursor.x)) * self.cell_w;
|
||||
const y = pad + @as(f64, @floatFromInt(cursor.y)) * self.cell_h;
|
||||
|
||||
const color: theme.Rgb = if (term.colors.cursor.get()) |c| .from(c) else theme.cursor();
|
||||
const color: theme.Rgb = if (term.colors.cursor.get()) |c| .fromVt(c) else theme.cursor();
|
||||
const r, const g, const b = color.cairoRgb();
|
||||
cr.setSourceRgb(r, g, b);
|
||||
|
||||
@@ -1191,7 +1191,7 @@ fn appearance(
|
||||
switch (cell.content_tag) {
|
||||
.bg_color_palette => return .{
|
||||
.fg = default_fg,
|
||||
.bg = .from(palette[cell.content.color_palette.data]),
|
||||
.bg = .fromVt(palette[cell.content.color_palette.data]),
|
||||
.bold = false,
|
||||
.italic = false,
|
||||
.underline = false,
|
||||
@@ -1216,12 +1216,12 @@ fn appearance(
|
||||
var fg: theme.Rgb = switch (style.fg_color) {
|
||||
.none => default_fg,
|
||||
.palette => |i| brightIfBold(palette, i, style.flags.bold),
|
||||
.rgb => |c| .from(c),
|
||||
.rgb => |c| .fromVt(c),
|
||||
};
|
||||
var bg: ?theme.Rgb = switch (style.bg_color) {
|
||||
.none => null,
|
||||
.palette => |i| .from(palette[i]),
|
||||
.rgb => |c| .from(c),
|
||||
.palette => |i| .fromVt(palette[i]),
|
||||
.rgb => |c| .fromVt(c),
|
||||
};
|
||||
|
||||
if (style.flags.inverse) {
|
||||
@@ -1247,5 +1247,5 @@ fn appearance(
|
||||
/// with the matching bright color.
|
||||
fn brightIfBold(palette: *const [256]vt.color.RGB, index: u8, bold: bool) theme.Rgb {
|
||||
const effective = if (bold and index < 8) index + 8 else index;
|
||||
return .from(palette[effective]);
|
||||
return .fromVt(palette[effective]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user