aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-client/src/settings.rs
diff options
context:
space:
mode:
authorP T Weir <phil.weir@flaxandteal.co.uk>2024-07-15 10:18:46 +0100
committerGitHub <noreply@github.com>2024-07-15 10:18:46 +0100
commit61c6e5e46a9caa45956239082ed8b6b524686453 (patch)
treec29c8594c337a76a95f1a544f5a2ee5a2bbb693a /crates/atuin-client/src/settings.rs
parentchore(deps): bump @tauri-apps/api in /ui (#2265) (diff)
downloadatuin-61c6e5e46a9caa45956239082ed8b6b524686453.zip
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
Diffstat (limited to 'crates/atuin-client/src/settings.rs')
-rw-r--r--crates/atuin-client/src/settings.rs27
1 files changed, 27 insertions, 0 deletions
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
@@ -339,6 +339,18 @@ pub struct Preview {
}
#[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<bool>,
+
+ /// How many levels of parenthood will be traversed if needed
+ pub max_depth: Option<u8>,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Daemon {
/// Use the daemon to sync
/// If enabled, requires a running daemon with `atuin daemon`
@@ -366,6 +378,16 @@ impl Default for Preview {
}
}
+impl Default for Theme {
+ fn default() -> Self {
+ Self {
+ name: "".to_string(),
+ debug: None::<bool>,
+ 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::<bool>)?
.set_default(
"prefers_reduced_motion",
std::env::var("NO_MOTION")