aboutsummaryrefslogtreecommitdiff
path: root/src/app/state.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-18 02:52:35 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-18 02:53:31 +0300
commit36b4001f4526b60f1c9b67a4a34596e5ad2bcca1 (patch)
tree520ab28a0a3f3f798e6e655fc83529e8617720e9 /src/app/state.rs
parentaca35ea76f3df15ec68fd07959d939f5e7a78a6c (diff)
feat: sync theme with host appearance
refs #675
Diffstat (limited to 'src/app/state.rs')
-rw-r--r--src/app/state.rs30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/app/state.rs b/src/app/state.rs
index 585bb3e4..55d41358 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -46,7 +46,7 @@ pub(crate) struct RightClickPassthroughGesture {
pub pane_info: PaneInfo,
pub modifiers: KeyModifiers,
}
-use crate::terminal_theme::TerminalTheme;
+use crate::terminal_theme::{HostAppearance, TerminalTheme};
use crate::workspace::Workspace;
// ---------------------------------------------------------------------------
@@ -55,7 +55,7 @@ use crate::workspace::Workspace;
/// All colors used by the UI. Derived from a base accent color for now,
/// but structured so a full theme system can replace it later.
-#[derive(Clone)]
+#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(dead_code)] // all fields defined for theming — some used later
pub struct Palette {
/// Primary accent (highlight, active borders).
@@ -978,6 +978,16 @@ impl SelectionListState {
}
}
+#[derive(Debug, Clone)]
+pub struct ThemeRuntimeConfig {
+ pub manual_name: String,
+ pub dark_name: String,
+ pub light_name: String,
+ pub auto_switch: bool,
+ pub custom: Option<crate::config::CustomThemeColors>,
+ pub legacy_accent: Option<String>,
+}
+
pub struct SettingsState {
/// Which section tab is active.
pub section: SettingsSection,
@@ -1384,6 +1394,12 @@ pub struct AppState {
pub palette: Palette,
/// Currently applied theme name (for settings UI).
pub theme_name: String,
+ /// Runtime theme configuration used to resolve manual and auto-switch palettes.
+ pub theme_runtime: ThemeRuntimeConfig,
+ /// Last known foreground host terminal appearance.
+ pub host_terminal_appearance: Option<HostAppearance>,
+ /// True when the foreground host explicitly reported appearance via Mode 2031.
+ pub host_terminal_appearance_explicit: bool,
/// Settings panel state.
pub settings: SettingsState,
/// Cached integration recommendations for onboarding/settings UI.
@@ -1722,6 +1738,16 @@ impl AppState {
spinner_tick: 0,
palette: Palette::catppuccin(),
theme_name: "catppuccin".to_string(),
+ theme_runtime: ThemeRuntimeConfig {
+ manual_name: "catppuccin".to_string(),
+ dark_name: "catppuccin".to_string(),
+ light_name: "catppuccin-latte".to_string(),
+ auto_switch: false,
+ custom: None,
+ legacy_accent: None,
+ },
+ host_terminal_appearance: None,
+ host_terminal_appearance_explicit: false,
settings: SettingsState {
section: SettingsSection::Theme,
list: SelectionListState::new(0),