feat: add adaptive app appearance

This commit is contained in:
Georg Bauer
2026-07-30 18:28:47 +02:00
parent d8a63c00f5
commit 1e3241bf65
4 changed files with 232 additions and 102 deletions

View File

@@ -32,6 +32,35 @@ impl IconStyle {
}
}
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AppearanceMode {
Light,
Dark,
#[default]
#[serde(other)]
Auto,
}
impl AppearanceMode {
pub fn index(self) -> i32 {
match self {
Self::Auto => 0,
Self::Light => 1,
Self::Dark => 2,
}
}
pub fn from_index(index: i32) -> Option<Self> {
match index {
0 => Some(Self::Auto),
1 => Some(Self::Light),
2 => Some(Self::Dark),
_ => None,
}
}
}
#[derive(Clone, Deserialize, Serialize)]
pub struct Server {
pub name: String,
@@ -54,6 +83,8 @@ pub struct Preferences {
pub pull_status: String,
#[serde(default)]
pub icon_style: IconStyle,
#[serde(default)]
pub appearance: AppearanceMode,
}
impl Default for Preferences {
@@ -65,6 +96,7 @@ impl Default for Preferences {
issue_status: open_status(),
pull_status: open_status(),
icon_style: IconStyle::default(),
appearance: AppearanceMode::default(),
}
}
}