From 61c6e5e46a9caa45956239082ed8b6b524686453 Mon Sep 17 00:00:00 2001 From: P T Weir Date: Mon, 15 Jul 2024 10:18:46 +0100 Subject: feat(tui): Customizable Themes (#2236) * wip: add theme * feat(theme): basic theming approach * feat(theme): adds theming support * fix: split out palette without compact inspector * fix(theme): tidy up implementation * fix(theme): correct yaml to toml * fix(theme): typo in comments * chore: cheer up clippy * fix(themes): ensure tests cannot hit real loading directory * chore: rustfmt * chore: rebase * feat(themes): add rgb hexcode support * fix(theme): add tests * fix(theme): use builtin log levels and correct debug test * feat(theme): adds the ability to derive from a non-base theme * fix(theme): warn if the in-file name of a theme does not match the filename * chore: tidy for rustfmt and clippy * chore: tidy for rustfmt and clippy --- crates/atuin-client/src/settings.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'crates/atuin-client/src/settings.rs') diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index 05da636b..b64418cd 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -338,6 +338,18 @@ pub struct Preview { pub strategy: PreviewStrategy, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Theme { + /// Name of desired theme ("" for base) + pub name: String, + + /// Whether any available additional theme debug should be shown + pub debug: Option, + + /// How many levels of parenthood will be traversed if needed + pub max_depth: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Daemon { /// Use the daemon to sync @@ -366,6 +378,16 @@ impl Default for Preview { } } +impl Default for Theme { + fn default() -> Self { + Self { + name: "".to_string(), + debug: None::, + max_depth: Some(10), + } + } +} + impl Default for Daemon { fn default() -> Self { Self { @@ -458,6 +480,9 @@ pub struct Settings { #[serde(default)] pub daemon: Daemon, + + #[serde(default)] + pub theme: Theme, } impl Settings { @@ -727,6 +752,8 @@ impl Settings { .set_default("daemon.socket_path", socket_path.to_str())? .set_default("daemon.systemd_socket", false)? .set_default("daemon.tcp_port", 8889)? + .set_default("theme.name", "")? + .set_default("theme.debug", None::)? .set_default( "prefers_reduced_motion", std::env::var("NO_MOTION") -- cgit v1.3.1