diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-18 02:52:35 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-18 02:53:31 +0300 |
| commit | 36b4001f4526b60f1c9b67a4a34596e5ad2bcca1 (patch) | |
| tree | 520ab28a0a3f3f798e6e655fc83529e8617720e9 /src/main.rs | |
| parent | aca35ea76f3df15ec68fd07959d939f5e7a78a6c (diff) | |
feat: sync theme with host appearance
refs #675
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 2217bef2..3c66ff1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,6 +42,18 @@ fn pop_keyboard_enhancement_flags() -> io::Result<()> { Ok(()) } +fn set_host_color_scheme_reports(enabled: bool) -> io::Result<()> { + use std::io::Write; + + let sequence = if enabled { + crate::terminal_theme::HOST_COLOR_SCHEME_REPORT_ENABLE_SEQUENCE + } else { + crate::terminal_theme::HOST_COLOR_SCHEME_REPORT_DISABLE_SEQUENCE + }; + io::stdout().write_all(sequence.as_bytes())?; + io::stdout().flush() +} + mod agent_resume; mod api; mod app; @@ -102,6 +114,12 @@ const DEFAULT_CONFIG: &str = r##"# herdr configuration # vesper # name = "catppuccin" +# Follow host terminal light/dark appearance and switch Herdr UI themes. +# Existing manual behavior is unchanged unless this is true. +# auto_switch = false +# dark_name = "catppuccin" +# light_name = "catppuccin-latte" + # Override individual color tokens on top of the base theme. # Accepts: hex (#rrggbb), named colors, rgb(r,g,b), or panel_bg = "reset" # [theme.custom] @@ -665,6 +683,7 @@ fn main() -> io::Result<()> { DisableBracketedPaste, DisableMouseCapture ); + let _ = set_host_color_scheme_reports(false); let _ = pop_keyboard_enhancement_flags(); ratatui::restore(); original_hook(info); @@ -691,6 +710,7 @@ fn main() -> io::Result<()> { execute!(io::stdout(), DisableMouseCapture)?; } execute!(io::stdout(), EnableBracketedPaste, EnableFocusChange)?; + set_host_color_scheme_reports(true)?; push_keyboard_enhancement_flags()?; // Some hosts do not honor Kitty keyboard enhancement pushes for @@ -728,6 +748,7 @@ fn main() -> io::Result<()> { DisableBracketedPaste, DisableMouseCapture )?; + set_host_color_scheme_reports(false)?; ratatui::restore(); // Drop app (and all workspaces/panes) before runtime shuts down |
