summaryrefslogtreecommitdiff
path: root/core/colors.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/colors.zig')
-rw-r--r--core/colors.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/colors.zig b/core/colors.zig
index 88cc6ea4..2a97ac69 100644
--- a/core/colors.zig
+++ b/core/colors.zig
@@ -832,6 +832,21 @@ pub fn themeIndex(name: []const u8) ?usize {
return null;
}
+/// The window wearing theme `index` (SPEC ยง5.1, a theme's preview), or
+/// its own again (null): nothing loaded, the session's theme and a theme
+/// file as they were; its chrome worked out once a theme, never a frame.
+/// The themes picker's (Pick.zig), and `:theme `'s argument rows'.
+pub fn previewTheme(p: *Pardes, index: ?usize) void {
+ const i = index orelse {
+ p.theme_preview = null;
+ return;
+ };
+ if (i >= themes.len) return;
+ if (p.theme_preview) |had| if (had == i) return;
+ p.theme_preview = @intCast(i);
+ p.preview_chrome = ChromeTheme.fromTheme(&themes[i]);
+}
+
pub fn setThemeIndex(p: *Pardes, index: usize) void {
if (index >= themes.len or
(p.custom_theme == null and p.theme_file_path.get().len == 0 and