diff options
| author | Jae-Heon Ji <32578710+jaeheonji@users.noreply.github.com> | 2022-07-24 21:30:58 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-24 21:30:58 +0900 |
| commit | 09481aac1986b7486e92d9dcd2baeb96a5d71e6e (patch) | |
| tree | c64e376d003e9fb01d5f5567854e4bb5d816243d /zellij-utils/src/input/unit | |
| parent | flake.lock: Update (#1601) (diff) | |
| download | sl0ppij-09481aac1986b7486e92d9dcd2baeb96a5d71e6e.tar.gz sl0ppij-09481aac1986b7486e92d9dcd2baeb96a5d71e6e.tar.xz sl0ppij-09481aac1986b7486e92d9dcd2baeb96a5d71e6e.zip | |
feat: support `themes` directory (#1577)
* feat: add serde struct for theme file
* feat: update client to load the theme palette
* feat: merge themes in the setup phase
* chore: delete debug message in test
* feat: add theme_dir options
* fix: boxing large enum variant
Diffstat (limited to 'zellij-utils/src/input/unit')
| -rw-r--r-- | zellij-utils/src/input/unit/fixtures/themes/dracula.yaml | 16 | ||||
| -rw-r--r-- | zellij-utils/src/input/unit/fixtures/themes/nord.yaml | 16 | ||||
| -rw-r--r-- | zellij-utils/src/input/unit/theme_test.rs | 22 |
3 files changed, 54 insertions, 0 deletions
diff --git a/zellij-utils/src/input/unit/fixtures/themes/dracula.yaml b/zellij-utils/src/input/unit/fixtures/themes/dracula.yaml new file mode 100644 index 00000000..b9c8a5af --- /dev/null +++ b/zellij-utils/src/input/unit/fixtures/themes/dracula.yaml @@ -0,0 +1,16 @@ +# Dracula Theme + +themes: + dracula: + # From https://github.com/dracula/zellij + bg: [40, 42, 54] + red: [255, 85, 85] + green: [80, 250, 123] + yellow: [241, 250, 140] + blue: [98, 114, 164] + magenta: [255, 121, 198] + orange: [255, 184, 108] + fg: [248, 248, 242] + cyan: [139, 233, 253] + black: [0, 0, 0] + white: [255, 255, 255] diff --git a/zellij-utils/src/input/unit/fixtures/themes/nord.yaml b/zellij-utils/src/input/unit/fixtures/themes/nord.yaml new file mode 100644 index 00000000..61851ad2 --- /dev/null +++ b/zellij-utils/src/input/unit/fixtures/themes/nord.yaml @@ -0,0 +1,16 @@ +# Nord theme + +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/src/input/unit/theme_test.rs b/zellij-utils/src/input/unit/theme_test.rs new file mode 100644 index 00000000..ad5b480a --- /dev/null +++ b/zellij-utils/src/input/unit/theme_test.rs @@ -0,0 +1,22 @@ +use super::super::theme::*; +use std::path::PathBuf; + +fn theme_test_dir(theme: String) -> PathBuf { + let root = Path::new(env!("CARGO_MANIFEST_DIR")); + let theme_dir = root.join("src/input/unit/fixtures/themes"); + theme_dir.join(theme) +} + +#[test] +fn dracula_theme_is_ok() { + let path = theme_test_dir("dracula.yaml".into()); + let theme = ThemesFromYaml::from_path(&path); + assert!(theme.is_ok()); +} + +#[test] +fn no_theme_is_err() { + let path = theme_test_dir("nonexistent.yaml".into()); + let theme = ThemesFromYaml::from_path(&path); + assert!(theme.is_err()); +} |
