summaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-29 14:53:26 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-30 15:07:21 +0200
commitce73b6cca0d6132a57a5a7a2321e1cec8b071720 (patch)
tree2aad7fc6a2b67d2c3957f6a4cc1b9599578651a7 /zellij-client
parent00bbe2b0f83cb1c4f5c121bc7c10fb5d3e523bab (diff)
Add color theme config
* add option `theme` that allows for setting of a theme, the default is `default` * under `themes` the themes can be described as follows: either: ``` themes: default: fg: [0,0,0] bg: [0,0,0] black: [0,0,0] red: [0,0,0] green: [0,0,0] yellow: [0,0,0] blue: [0,0,0] magenta: [0,0,0] cyan: [0,0,0] white: [0,0,0] orange: [0,0,0] ``` or ``` themes: default: fg: 0 bg: 0 black: 0 red: 0 green: 0 yellow: 0 blue: 0 magenta: 0 cyan: 0 white: 0 orange: 0 ``` If the key is different from default, it needs to either be specified on start with `options --theme [THEME]`, or in the configuration file under theme: [THEME]. closes #390
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/src/lib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs
index 3817e7908..7ea4f81ee 100644
--- a/zellij-client/src/lib.rs
+++ b/zellij-client/src/lib.rs
@@ -91,7 +91,14 @@ pub fn start_client(
let take_snapshot = "\u{1b}[?1049h";
let bracketed_paste = "\u{1b}[?2004h";
os_input.unset_raw_mode(0);
- let palette = os_input.load_palette();
+ let config_options = Options::from_cli(&config.options, opts.command.clone());
+ let palette = config.themes.clone().map_or_else(
+ || os_input.load_palette(),
+ |t| {
+ t.theme_config(&config_options)
+ .unwrap_or_else(|| os_input.load_palette())
+ },
+ );
let _ = os_input
.get_stdout_writer()
.write(take_snapshot.as_bytes())
@@ -102,8 +109,6 @@ pub fn start_client(
.unwrap();
std::env::set_var(&"ZELLIJ", "0");
- let config_options = Options::from_cli(&config.options, opts.command.clone());
-
let full_screen_ws = os_input.get_terminal_size_using_fd(0);
let client_attributes = ClientAttributes {
position_and_size: full_screen_ws,