feat: add unfocused tab colors
Some checks are pending
Release tarball / release_tarball (push) Waiting to run

This commit is contained in:
CJ van den Berg 2026-01-20 12:18:23 +01:00
parent 870b0340c6
commit c6c7f18cfb
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 40 additions and 0 deletions

View file

@ -89,6 +89,8 @@ fn load_json(theme_: *theme_file) theme {
.tab_active = derive_style.tab_active(type_idx, cb),
.tab_inactive = derive_style.tab_inactive(type_idx, cb),
.tab_selected = derive_style.tab_selected(type_idx, cb),
.tab_unfocused_active = derive_style.tab_unfocused_active(type_idx, cb),
.tab_unfocused_inactive = derive_style.tab_unfocused_inactive(type_idx, cb),
};
}
@ -630,6 +632,20 @@ const derive_style = struct {
.bg = if (find_color("tab.selectedBackground", cb)) |col| col else defaults.@"tab.selectedBackground"(type_idx, cb),
};
}
fn tab_unfocused_active(type_idx: usize, cb: []const u8) Style {
return .{
.fg = if (find_color("tab.unfocusedActiveForeground", cb)) |col| col else defaults.@"tab.unfocusedActiveForeground"(type_idx, cb),
.bg = if (find_color("tab.unfocusedActiveBackground", cb)) |col| col else defaults.@"tab.unfocusedActiveBackground"(type_idx, cb),
};
}
fn tab_unfocused_inactive(type_idx: usize, cb: []const u8) Style {
return .{
.fg = if (find_color("tab.unfocusedInactiveForeground", cb)) |col| col else defaults.@"tab.unfocusedInactiveForeground"(type_idx, cb),
.bg = if (find_color("tab.unfocusedInactiveBackground", cb)) |col| col else defaults.@"tab.unfocusedInactiveBackground"(type_idx, cb),
};
}
};
const defaults = struct {
@ -922,6 +938,28 @@ const defaults = struct {
fn @"tab.selectedForeground"(type_idx: usize, cb: []const u8) ?Color {
return .{ .color = derive_style.tab_active(type_idx, cb).fg.?.color };
}
fn @"tab.unfocusedActiveBackground"(type_idx: usize, cb: []const u8) ?Color {
return derive_style.tab_inactive(type_idx, cb).fg;
}
fn @"tab.unfocusedActiveForeground"(type_idx: usize, cb: []const u8) ?Color {
return ([2]Color{
.{ .color = derive_style.tab_active(type_idx, cb).fg.?.color, .alpha = 256 / 2 },
.{ .color = derive_style.tab_active(type_idx, cb).fg.?.color, .alpha = 256 * 7 / 10 },
})[type_idx];
}
fn @"tab.unfocusedInactiveBackground"(type_idx: usize, cb: []const u8) ?Color {
return derive_style.tab_active(type_idx, cb).fg;
}
fn @"tab.unfocusedInactiveForeground"(type_idx: usize, cb: []const u8) ?Color {
return ([2]Color{
.{ .color = derive_style.tab_inactive(type_idx, cb).fg.?.color, .alpha = 256 / 2 },
.{ .color = derive_style.tab_inactive(type_idx, cb).fg.?.color, .alpha = 256 / 2 },
})[type_idx];
}
};
const Writer = std.fs.File.Writer;

View file

@ -36,6 +36,8 @@ input_option_hover: Style,
tab_active: Style,
tab_inactive: Style,
tab_selected: Style,
tab_unfocused_active: Style,
tab_unfocused_inactive: Style,
tokens: Tokens,