summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig27
1 files changed, 16 insertions, 11 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 8c946787..f9e32eec 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -47,7 +47,7 @@ const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET;
const TOPBAR_H = pardes.TOPBAR_H;
const TagHit = pardes.TagHit;
const Text = pardes.panes.Text;
-const Theme = pardes.Theme;
+const LegacyTheme = pardes.LegacyTheme;
const builtins = pardes.builtins;
const colors = pardes.colors;
const column_weight_unit = layout.column_weight_unit;
@@ -78,7 +78,6 @@ const sel_slot = pardes.sel_slot;
const syntax = pardes.syntax;
const tagline = pardes.tagline;
const test_api = pardes.test_api;
-const themes = pardes.themes;
const turn = &pardes.turn;
const Views = pardes.views;
@@ -346,21 +345,21 @@ locations_config: locations.Config = .{},
locations_cache: locations.Cache = .{},
tty_filter_palette: pardes.Term.FilterPalette = .{},
font_request_taken: bool = false,
-custom_theme: ?Theme = null,
+custom_theme: ?LegacyTheme = null,
/// The theme the window wears while a picker of them (or `:theme `)
/// previews one, by index, and its chrome (colors.previewTheme); the
/// session's own theme untouched under it.
theme_preview: ?u16 = null,
-preview_chrome: ChromeTheme = colors.initial_chrome,
+preview_chrome: ChromeTheme = undefined,
/// bodyChrome's: the theme it was worked out for, and it.
-body_chrome: ?struct { theme: Theme, chrome: ChromeTheme } = null,
+body_chrome: ?struct { theme: LegacyTheme, chrome: ChromeTheme } = null,
theme_file_path: config.Settings.Text(limits.host_path_cap) = .{},
/// The ThemeFile last loaded whole: what /ctl and DumpConfig name, and
/// what a failed ThemeFile goes back to (colors.revertThemeFile).
theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{},
theme_file_generation: u32 = 0,
theme_file_pane: Pane.Id = .at(0),
-chrome: colors.ChromeTheme = colors.initial_chrome,
+theme_chrome: colors.ChromeTheme = undefined,
/// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES):
/// its runner's (`Options.frames`), which its frontend writes as it draws
/// and reads input, never the core's memory; a core with no runner (a
@@ -523,7 +522,7 @@ pub const replica = .{
// A frame, and the timings that make it.
"surface", "facts", "frames",
"own_frames",
- "chrome",
+ "theme_chrome",
"frame_arena", "scratch", "needs_frame",
"echo",
// Drained by every pump before its digest; a replica's queues
@@ -2162,16 +2161,22 @@ fn sizes(p: *const Pardes, pane: *const Pane) bool {
return pane.sized_by == p.live;
}
-pub fn theme(p: *const Pardes) *const Theme {
- if (p.theme_preview) |i| return &themes[i];
+pub fn theme(p: *const Pardes) *const LegacyTheme {
+ if (p.theme_preview) |i| return &colors.legacy_themes[i];
if (p.custom_theme) |*custom| return custom;
- return &themes[p.settings.theme];
+ return &colors.legacy_themes[p.settings.theme];
}
/// The colours of the chrome: the theme's, set as it changes.
pub fn chromeTheme(p: *const Pardes) *const ChromeTheme {
if (p.theme_preview != null) return &p.preview_chrome;
- return &p.chrome;
+ return &p.theme_chrome;
+}
+
+/// Every colour a surface draws (colors.Chrome), the theme's or the one a
+/// picker previews: worked out as the theme changes, never a frame.
+pub fn chrome(p: *const Pardes) *const colors.Chrome {
+ return &p.chromeTheme().resolved;
}
/// The theme's own chrome, not a fade's (`theme()`'s, worked out once