summaryrefslogtreecommitdiffstats
path: root/zellij-utils
diff options
context:
space:
mode:
authorJae-Heon Ji <32578710+jaeheonji@users.noreply.github.com>2023-04-27 00:26:07 +0900
committerGitHub <noreply@github.com>2023-04-27 00:26:07 +0900
commitff36798c9e52c9c73111afd03c9a69ecb1aee073 (patch)
treec03640f71a6dc08ef544e8dd34aa4ce5c49ff28f /zellij-utils
parent0a8bbd7f2310b849dec324aae88c546f82ec7fe8 (diff)
feat: provide default themes (#2307)
* refactor: move themes to zellij-assets * feat: add theme to the binary * chore: move new theme from example to assets
Diffstat (limited to 'zellij-utils')
-rwxr-xr-xzellij-utils/assets/plugins/compact-bar.wasmbin794980 -> 490119 bytes
-rwxr-xr-xzellij-utils/assets/plugins/status-bar.wasmbin921339 -> 621069 bytes
-rwxr-xr-xzellij-utils/assets/plugins/strider.wasmbin809895 -> 503181 bytes
-rwxr-xr-xzellij-utils/assets/plugins/tab-bar.wasmbin765705 -> 458835 bytes
-rw-r--r--zellij-utils/assets/themes/catppuccin.kdl60
-rw-r--r--zellij-utils/assets/themes/dracula.kdl17
-rw-r--r--zellij-utils/assets/themes/everforest-dark.kdl15
-rw-r--r--zellij-utils/assets/themes/everforest-light.kdl15
-rw-r--r--zellij-utils/assets/themes/gruvbox.kdl29
-rw-r--r--zellij-utils/assets/themes/kanagawa.kdl15
-rw-r--r--zellij-utils/assets/themes/menace.kdl17
-rw-r--r--zellij-utils/assets/themes/molokai-dark.kdl16
-rw-r--r--zellij-utils/assets/themes/nightfox.kdl44
-rw-r--r--zellij-utils/assets/themes/nord.kdl15
-rw-r--r--zellij-utils/assets/themes/one-half-dark.kdl16
-rw-r--r--zellij-utils/assets/themes/pencil.kdl15
-rw-r--r--zellij-utils/assets/themes/solarized-dark.kdl16
-rw-r--r--zellij-utils/assets/themes/solarized-light.kdl16
-rw-r--r--zellij-utils/assets/themes/tokyo-night-dark.kdl15
-rw-r--r--zellij-utils/assets/themes/tokyo-night-light.kdl16
-rw-r--r--zellij-utils/assets/themes/tokyo-night-storm.kdl16
-rw-r--r--zellij-utils/assets/themes/tokyo-night.kdl16
-rw-r--r--zellij-utils/src/consts.rs14
-rw-r--r--zellij-utils/src/kdl/mod.rs14
-rw-r--r--zellij-utils/src/setup.rs38
25 files changed, 415 insertions, 20 deletions
diff --git a/zellij-utils/assets/plugins/compact-bar.wasm b/zellij-utils/assets/plugins/compact-bar.wasm
index 0e3598d0b..d59cb92b8 100755
--- a/zellij-utils/assets/plugins/compact-bar.wasm
+++ b/zellij-utils/assets/plugins/compact-bar.wasm
Binary files differ
diff --git a/zellij-utils/assets/plugins/status-bar.wasm b/zellij-utils/assets/plugins/status-bar.wasm
index a1d0c8179..63907aed5 100755
--- a/zellij-utils/assets/plugins/status-bar.wasm
+++ b/zellij-utils/assets/plugins/status-bar.wasm
Binary files differ
diff --git a/zellij-utils/assets/plugins/strider.wasm b/zellij-utils/assets/plugins/strider.wasm
index 37da81bcc..39909aaa4 100755
--- a/zellij-utils/assets/plugins/strider.wasm
+++ b/zellij-utils/assets/plugins/strider.wasm
Binary files differ
diff --git a/zellij-utils/assets/plugins/tab-bar.wasm b/zellij-utils/assets/plugins/tab-bar.wasm
index 38f17dfc1..5f59fe4fe 100755
--- a/zellij-utils/assets/plugins/tab-bar.wasm
+++ b/zellij-utils/assets/plugins/tab-bar.wasm
Binary files differ
diff --git a/zellij-utils/assets/themes/catppuccin.kdl b/zellij-utils/assets/themes/catppuccin.kdl
new file mode 100644
index 000000000..b8e70bbb6
--- /dev/null
+++ b/zellij-utils/assets/themes/catppuccin.kdl
@@ -0,0 +1,60 @@
+// Catppuccin Theme:
+// https://github.com/catppuccin/catppuccin
+
+themes {
+ catppuccin-latte {
+ bg "#acb0be" // Surface2
+ fg "#acb0be" // Surface2
+ red "#d20f39"
+ green "#40a02b"
+ blue "#1e66f5"
+ yellow "#df8e1d"
+ magenta "#ea76cb" // Pink
+ orange "#fe640b" // Peach
+ cyan "#04a5e5" // Sky
+ black "#dce0e8" // Crust
+ white "#4c4f69" // Text
+ }
+
+ catppuccin-frappe {
+ bg "#626880" // Surface2
+ fg "#c6d0f5"
+ red "#e78284"
+ green "#a6d189"
+ blue "#8caaee"
+ yellow "#e5c890"
+ magenta "#f4b8e4" // Pink
+ orange "#ef9f76" // Peach
+ cyan "#99d1db" // Sky
+ black "#292c3c" // Mantle
+ white "#c6d0f5"
+ }
+
+ catppuccin-macchiato {
+ bg "#5b6078" // Surface2
+ fg "#cad3f5"
+ red "#ed8796"
+ green "#a6da95"
+ blue "#8aadf4"
+ yellow "#eed49f"
+ magenta "#f5bde6" // Pink
+ orange "#f5a97f" // Peach
+ cyan "#91d7e3" // Sky
+ black "#1e2030" // Mantle
+ white "#cad3f5"
+ }
+
+ catppuccin-mocha {
+ bg "#585b70" // Surface2
+ fg "#cdd6f4"
+ red "#f38ba8"
+ green "#a6e3a1"
+ blue "#89b4fa"
+ yellow "#f9e2af"
+ magenta "#f5c2e7" // Pink
+ orange "#fab387" // Peach
+ cyan "#89dceb" // Sky
+ black "#181825" // Mantle
+ white "#cdd6f4"
+ }
+}
diff --git a/zellij-utils/assets/themes/dracula.kdl b/zellij-utils/assets/themes/dracula.kdl
new file mode 100644
index 000000000..26f20504e
--- /dev/null
+++ b/zellij-utils/assets/themes/dracula.kdl
@@ -0,0 +1,17 @@
+// From https://github.com/dracula/zellij
+
+themes {
+ dracula {
+ fg 248 248 242
+ bg 40 42 54
+ black 0 0 0
+ red 255 85 85
+ green 80 250 123
+ yellow 241 250 140
+ blue 98 114 164
+ magenta 255 121 198
+ cyan 139 233 253
+ white 255 255 255
+ orange 255 184 108
+ }
+}
diff --git a/zellij-utils/assets/themes/everforest-dark.kdl b/zellij-utils/assets/themes/everforest-dark.kdl
new file mode 100644
index 000000000..00f996fec
--- /dev/null
+++ b/zellij-utils/assets/themes/everforest-dark.kdl
@@ -0,0 +1,15 @@
+themes {
+ everforest-dark {
+ bg "#2b3339"
+ fg "#d3c6aa"
+ black "#4b565c"
+ red "#e67e80"
+ green "#a7c080"
+ yellow "#dbbc7f"
+ blue "#7fbbb3"
+ magenta "#d699b6"
+ cyan "#83c092"
+ white "#d3c6aa"
+ orange "#FF9E64"
+ }
+}
diff --git a/zellij-utils/assets/themes/everforest-light.kdl b/zellij-utils/assets/themes/everforest-light.kdl
new file mode 100644
index 000000000..0bfb9d8f6
--- /dev/null
+++ b/zellij-utils/assets/themes/everforest-light.kdl
@@ -0,0 +1,15 @@
+themes {
+ everforest-light {
+ bg "#fff9e8"
+ fg "#5c6a72"
+ black "#5c6a72"
+ red "#f85552"
+ green "#8da101"
+ yellow "#dfa000"
+ blue "#3a94c5"
+ magenta "#df69ba"
+ cyan "#35a77c"
+ white "#dfddc8"
+ orange "#FF9E64"
+ }
+}
diff --git a/zellij-utils/assets/themes/gruvbox.kdl b/zellij-utils/assets/themes/gruvbox.kdl
new file mode 100644
index 000000000..2c7ca0c8f
--- /dev/null
+++ b/zellij-utils/assets/themes/gruvbox.kdl
@@ -0,0 +1,29 @@
+themes {
+ gruvbox-light {
+ fg 60 56 54
+ bg 251 82 75
+ black 40 40 40
+ red 205 75 69
+ green 152 151 26
+ yellow 215 153 33
+ blue 69 133 136
+ magenta 177 98 134
+ cyan 104 157 106
+ white 213 196 161
+ orange 214 93 14
+ }
+ gruvbox-dark {
+ fg 213 196 161
+ bg 40 40 40
+ black 60 56 54
+ red 204 36 29
+ green 152 151 26
+ yellow 215 153 33
+ blue 69 133 136
+ magenta 177 98 134
+ cyan 104 157 106
+ white 251 241 199
+ orange 214 93 14
+ }
+}
+
diff --git a/zellij-utils/assets/themes/kanagawa.kdl b/zellij-utils/assets/themes/kanagawa.kdl
new file mode 100644
index 000000000..f0b575555
--- /dev/null
+++ b/zellij-utils/assets/themes/kanagawa.kdl
@@ -0,0 +1,15 @@
+themes {
+ kanagawa {
+ fg "#DCD7BA"
+ bg "#1F1F28"
+ red "#C34043"
+ green "#76946A"
+ yellow "#FF9E3B"
+ blue "#7E9CD8"
+ magenta "#957FB8"
+ orange "#FFA066"
+ cyan "#7FB4CA"
+ black "#16161D"
+ white "#DCD7BA"
+ }
+}
diff --git a/zellij-utils/assets/themes/menace.kdl b/zellij-utils/assets/themes/menace.kdl
new file mode 100644
index 000000000..e0840df36
--- /dev/null
+++ b/zellij-utils/assets/themes/menace.kdl
@@ -0,0 +1,17 @@
+// orange-green-blue
+
+themes {
+ menace {
+ fg "#e3a555"
+ bg 40 42 54
+ red "#f74c17"
+ green 80 250 123
+ yellow 241 250 140
+ blue 98 114 164
+ magenta 255 121 198
+ orange 255 184 108
+ cyan 139 233 253
+ black "#04399d"
+ white 255 255 255
+ }
+}
diff --git a/zellij-utils/assets/themes/molokai-dark.kdl b/zellij-utils/assets/themes/molokai-dark.kdl
new file mode 100644
index 000000000..6fd96f9af
--- /dev/null
+++ b/zellij-utils/assets/themes/molokai-dark.kdl
@@ -0,0 +1,16 @@
+themes {
+ molokai-dark {
+ fg 248 248 240
+ bg 27 29 30
+ black 0 0 0
+ red 255 0 0
+ green 0 140 0
+ yellow 255 255 0
+ blue 102 217 239
+ magenta 174 129 255
+ cyan 0 255 255
+ white 255 255 255
+ orange 253 151 31
+ }
+}
+
diff --git a/zellij-utils/assets/themes/nightfox.kdl b/zellij-utils/assets/themes/nightfox.kdl
new file mode 100644
index 000000000..e40075b47
--- /dev/null
+++ b/zellij-utils/assets/themes/nightfox.kdl
@@ -0,0 +1,44 @@
+// Nightfox Theme:
+// https://github.com/edeneast/nightfox.nvim
+
+themes {
+ dayfox {
+ bg "#f6f2ee"
+ fg "#3d2b5a"
+ red "#a5222f"
+ green "#396847"
+ blue "#2848a9"
+ yellow "#ac5402"
+ magenta "#6e33ce"
+ orange "#955f61"
+ cyan "#287980"
+ black "#d3c7bb"
+ white "#643f61"
+ }
+ nightfox {
+ bg "#192330"
+ fg "#cdcecf"
+ red "#c94f6d"
+ green "#81b29a"
+ blue "#719cd6"
+ yellow "#dbc074"
+ magenta "#9d79d6"
+ orange "#f4a261"
+ cyan "#63cdcf"
+ black "#29394f"
+ white "#aeafb0"
+ }
+ terafox {
+ bg "#152528"
+ fg "#e6eaea"
+ red "#e85c51"
+ green "#7aa4a1"
+ blue "#5a93aa"
+ yellow "#fda47f"
+ magenta "#ad5c7c"
+ orange "#ff8349"
+ cyan "#a1cdd8"
+ black "#254147"
+ white "#cbd9d8"
+ }
+}
diff --git a/zellij-utils/assets/themes/nord.kdl b/zellij-utils/assets/themes/nord.kdl
new file mode 100644
index 000000000..a56a9bfb3
--- /dev/null
+++ b/zellij-utils/assets/themes/nord.kdl
@@ -0,0 +1,15 @@
+themes {
+ nord {
+ fg 216 222 233 // #D8DEE9
+ bg 46 52 64 // #2E3440
+ black 59 66 82 // #3B4252
+ red 191 97 106 // #BF616A
+ green 163 190 140 // #A3BE8C
+ yellow 235 203 139 // #EBCB8B
+ blue 129 161 193 // #81A1C1
+ magenta 180 142 173 // #B48EAD
+ cyan 136 192 208 // #88C0D0
+ white 229 233 240 // #E5E9F0
+ orange 208 135 112 // #D08770
+ }
+}
diff --git a/zellij-utils/assets/themes/one-half-dark.kdl b/zellij-utils/assets/themes/one-half-dark.kdl
new file mode 100644
index 000000000..ade1874bf
--- /dev/null
+++ b/zellij-utils/assets/themes/one-half-dark.kdl
@@ -0,0 +1,16 @@
+themes {
+ one-half-dark {
+ fg 220 223 228
+ bg 40 44 52
+ black 27 29 35
+ red 227 63 76
+ green 152 195 121
+ yellow 229 192 123
+ blue 97 175 239
+ magenta 198 120 221
+ cyan 86 182 194
+ white 233 225 254
+ orange 216 133 76
+ }
+}
+
diff --git a/zellij-utils/assets/themes/pencil.kdl b/zellij-utils/assets/themes/pencil.kdl
new file mode 100644
index 000000000..166368349
--- /dev/null
+++ b/zellij-utils/assets/themes/pencil.kdl
@@ -0,0 +1,15 @@
+themes {
+ pencil-light {
+ fg "#005F87"
+ bg "#f1f1f1"
+ black "#f1f1f1"
+ red "#B6D6FD"
+ green "#10A778"
+ yellow "#A89C14"
+ blue "#008EC4"
+ magenta "#B6D6FD"
+ cyan "#20A5BA"
+ white "#424242"
+ orange "#D75F5F"
+ }
+}
diff --git a/zellij-utils/assets/themes/solarized-dark.kdl b/zellij-utils/assets/themes/solarized-dark.kdl
new file mode 100644
index 000000000..20482f5c3
--- /dev/null
+++ b/zellij-utils/assets/themes/solarized-dark.kdl
@@ -0,0 +1,16 @@
+themes {
+ solarized-dark {
+ fg 253 246 227
+ bg 0 43 54
+ black 7 54 66
+ red 220 50 47
+ green 133 153 0
+ yellow 181 137 0
+ blue 38 139 210
+ magenta 211 54 130
+ cyan 42 161 152
+ white 238 232 213
+ orange 203 75 22
+ }
+}
+
diff --git a/zellij-utils/assets/themes/solarized-light.kdl b/zellij-utils/assets/themes/solarized-light.kdl
new file mode 100644
index 000000000..93bac49b7
--- /dev/null
+++ b/zellij-utils/assets/themes/solarized-light.kdl
@@ -0,0 +1,16 @@
+themes {
+ solarized-light {
+ fg 101 123 131
+ bg 253 246 227
+ black 7 54 66
+ red 220 50 47
+ green 133 153 0
+ yellow 181 137 0
+ blue 38 139 210
+ magenta 211 54 130
+ cyan 42 161 152
+ white 238 232 213
+ orange 203 75 22
+ }
+}
+
diff --git a/zellij-utils/assets/themes/tokyo-night-dark.kdl b/zellij-utils/assets/themes/tokyo-night-dark.kdl
new file mode 100644
index 000000000..6813a3360
--- /dev/null
+++ b/zellij-utils/assets/themes/tokyo-night-dark.kdl
@@ -0,0 +1,15 @@
+themes {
+ tokyo-night-dark {
+ fg 169 177 214
+ bg 26 27 38
+ black 56 62 90
+ red 249 51 87
+ green 158 206 106
+ yellow 224 175 104
+ blue 122 162 247
+ magenta 187 154 247
+ cyan 42 195 222
+ white 192 202 245
+ orange 255 158 100
+ }
+}
diff --git a/zellij-utils/assets/themes/tokyo-night-light.kdl b/zellij-utils/assets/themes/tokyo-night-light.kdl
new file mode 100644
index 000000000..3ac5fb767
--- /dev/null
+++ b/zellij-utils/assets/themes/tokyo-night-light.kdl
@@ -0,0 +1,16 @@
+themes {
+ tokyo-night-light {
+ fg 52 59 88
+ bg 213 214 219
+ black 15 15 20
+ red 186 75 96
+ green 72 94 48
+ yellow 143 94 21
+ blue 52 84 138
+ magenta 90 74 120
+ cyan 15 75 110
+ white 130 137 172
+ orange 150 80 39
+ }
+}
+
diff --git a/zellij-utils/assets/themes/tokyo-night-storm.kdl b/zellij-utils/assets/themes/tokyo-night-storm.kdl
new file mode 100644
index 000000000..e727ef72f
--- /dev/null
+++ b/zellij-utils/assets/themes/tokyo-night-storm.kdl
@@ -0,0 +1,16 @@
+themes {
+ tokyo-night-storm {
+ fg 169 177 214
+ bg 36 40 59
+ black 56 62 90
+ red 249 51 87
+ green 158 206 106
+ yellow 224 175 104
+ blue 122 162 247
+ magenta 187 154 247
+ cyan 42 195 222
+ white 192 202 245
+ orange 255 158 100
+ }
+}
+
diff --git a/zellij-utils/assets/themes/tokyo-night.kdl b/zellij-utils/assets/themes/tokyo-night.kdl
new file mode 100644
index 000000000..4ea1a8104
--- /dev/null
+++ b/zellij-utils/assets/themes/tokyo-night.kdl
@@ -0,0 +1,16 @@
+themes {
+ tokyo-night {
+ fg 169 177 214
+ bg 26 27 38
+ black 56 62 90
+ red 249 51 87
+ green 158 206 106
+ yellow 224 175 104
+ blue 122 162 247
+ magenta 187 154 247
+ cyan 42 195 222
+ white 192 202 245
+ orange 255 158 100
+ }
+}
+
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs
index 5709db891..b851b1524 100644
--- a/zellij-utils/src/consts.rs
+++ b/zellij-utils/src/consts.rs
@@ -1,5 +1,6 @@
//! Zellij program-wide constants.
+use crate::input::theme::Themes;
use directories_next::ProjectDirs;
use lazy_static::lazy_static;
use once_cell::sync::OnceCell;
@@ -28,6 +29,19 @@ lazy_static! {
pub static ref ZELLIJ_PROJ_DIR: ProjectDirs =
ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
pub static ref ZELLIJ_CACHE_DIR: PathBuf = ZELLIJ_PROJ_DIR.cache_dir().to_path_buf();
+ pub static ref ZELLIJ_DEFAULT_THEMES: Themes = {
+ let mut default_themes = Themes::default();
+
+ let path = PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/themes"));
+ match Themes::from_dir(path) {
+ Ok(themes) => {
+ default_themes = default_themes.merge(themes);
+ },
+ Err(_) => {},
+ }
+
+ default_themes
+ };
}
pub const FEATURES: &[&str] = &[
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index a892cf8c3..1d488f39d 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -1758,4 +1758,18 @@ impl Themes {
let all_themes_in_file = Themes::from_kdl(kdl_themes)?;
Ok(all_themes_in_file)
}
+
+ pub fn from_dir(path_to_theme_dir: PathBuf) -> Result<Self, ConfigError> {
+ let mut themes = Themes::default();
+ for entry in std::fs::read_dir(path_to_theme_dir)? {
+ let entry = entry?;
+ let path = entry.path();
+ if let Some(extension) = path.extension() {
+ if extension == "kdl" {
+ themes = themes.merge(Themes::from_path(path)?);
+ }
+ }
+ }
+ Ok(themes)
+ }
}
diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs
index 0086c6a99..a40df7091 100644
--- a/zellij-utils/src/setup.rs
+++ b/zellij-utils/src/setup.rs
@@ -5,7 +5,7 @@ use crate::{
cli::{CliArgs, Command},
consts::{
FEATURES, SYSTEM_DEFAULT_CONFIG_DIR, SYSTEM_DEFAULT_DATA_DIR_PREFIX, VERSION,
- ZELLIJ_PROJ_DIR,
+ ZELLIJ_DEFAULT_THEMES, ZELLIJ_PROJ_DIR,
},
errors::prelude::*,
input::{
@@ -63,6 +63,16 @@ pub fn get_default_data_dir() -> PathBuf {
.unwrap_or_else(xdg_data_dir)
}
+#[cfg(not(test))]
+fn get_default_themes() -> Themes {
+ ZELLIJ_DEFAULT_THEMES.to_owned()
+}
+
+#[cfg(test)]
+fn get_default_themes() -> Themes {
+ Themes::default()
+}
+
pub fn xdg_config_dir() -> PathBuf {
ZELLIJ_PROJ_DIR.config_dir().to_owned()
}
@@ -310,25 +320,13 @@ impl Setup {
None => config.options.clone(),
};
- if let Some(theme_dir) = config_options
- .theme_dir
- .clone()
- .or_else(|| get_theme_dir(cli_args.config_dir.clone().or_else(find_default_config_dir)))
- {
- if theme_dir.is_dir() {
- for entry in (theme_dir.read_dir()?).flatten() {
- if let Some(extension) = entry.path().extension() {
- if extension == "kdl" {
- match Themes::from_path(entry.path()) {
- Ok(themes) => config.themes = config.themes.merge(themes),
- Err(e) => {
- log::error!("error loading theme file: {:?}", e);
- },
- }
- }
- }
- }
- }
+ config.themes = config.themes.merge(get_default_themes());
+
+ let user_theme_dir = config_options.theme_dir.clone().or_else(|| {
+ get_theme_dir(cli_args.config_dir.clone().or_else(find_default_config_dir))
+ });
+ if let Some(user_theme_dir) = user_theme_dir {
+ config.themes = config.themes.merge(Themes::from_dir(user_theme_dir)?);
}
if let Some(Command::Setup(ref setup)) = &cli_args.command {