aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-08-20 16:10:27 +0200
committerGitHub <noreply@github.com>2024-08-20 16:10:27 +0200
commite96491a3cf120f53798ec59de13283c8fb39605f (patch)
treea6978caca40ff476548308e2169d9ec0a9dc6299 /zellij-utils/src
parentdocs(changelog): reload config at runtime (diff)
downloadsl0ppij-e96491a3cf120f53798ec59de13283c8fb39605f.tar.gz
sl0ppij-e96491a3cf120f53798ec59de13283c8fb39605f.tar.xz
sl0ppij-e96491a3cf120f53798ec59de13283c8fb39605f.zip
feat(ux): change themes at runtime (#3559)
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/data.rs3
-rw-r--r--zellij-utils/src/input/config.rs4
2 files changed, 5 insertions, 2 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs
index 59653e78..f1e95df2 100644
--- a/zellij-utils/src/data.rs
+++ b/zellij-utils/src/data.rs
@@ -1175,6 +1175,9 @@ impl ModeInfo {
pub fn update_default_mode(&mut self, new_default_mode: InputMode) {
self.base_mode = Some(new_default_mode);
}
+ pub fn update_theme(&mut self, theme: Palette) {
+ self.style.colors = theme;
+ }
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs
index cf3ba2cc..49ff5c2e 100644
--- a/zellij-utils/src/input/config.rs
+++ b/zellij-utils/src/input/config.rs
@@ -163,8 +163,8 @@ impl TryFrom<&CliArgs> for Config {
}
impl Config {
- pub fn theme_config(&self, opts: &Options) -> Option<Palette> {
- match &opts.theme {
+ pub fn theme_config(&self, theme_name: Option<&String>) -> Option<Palette> {
+ match &theme_name {
Some(theme_name) => self.themes.get_theme(theme_name).map(|theme| theme.palette),
None => self.themes.get_theme("default").map(|theme| theme.palette),
}