feat: add custom theme support with color picker UI
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 55s
CI / Lint & Test (pull_request) Failing after 5m43s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped

- Add Custom variant to Theme enum and CustomThemeColors struct in Rust config
- Add custom_theme_colors field to HikariConfig for storing user-defined colors
- Create color picker UI in ConfigSidebar with 8 customizable color variables
- Implement live preview when editing custom theme colors
- Apply custom colors on app startup when custom theme is selected
- Use dark theme as base, override with user's custom CSS variables
This commit is contained in:
2026-01-25 20:50:11 -08:00
committed by Naomi Carrigan
parent 73d66e9ae4
commit c45414b0aa
5 changed files with 337 additions and 13 deletions
+31
View File
@@ -92,6 +92,10 @@ pub struct HikariConfig {
#[serde(default)]
pub profile_bio: Option<String>,
// Custom theme colors
#[serde(default)]
pub custom_theme_colors: CustomThemeColors,
}
impl Default for HikariConfig {
@@ -118,6 +122,7 @@ impl Default for HikariConfig {
profile_name: None,
profile_avatar_path: None,
profile_bio: None,
custom_theme_colors: CustomThemeColors::default(),
}
}
}
@@ -150,6 +155,27 @@ pub enum Theme {
Light,
#[serde(rename = "high-contrast")]
HighContrast,
Custom,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
pub struct CustomThemeColors {
#[serde(default)]
pub bg_primary: Option<String>,
#[serde(default)]
pub bg_secondary: Option<String>,
#[serde(default)]
pub bg_terminal: Option<String>,
#[serde(default)]
pub accent_primary: Option<String>,
#[serde(default)]
pub accent_secondary: Option<String>,
#[serde(default)]
pub text_primary: Option<String>,
#[serde(default)]
pub text_secondary: Option<String>,
#[serde(default)]
pub border_color: Option<String>,
}
#[cfg(test)]
@@ -178,6 +204,7 @@ mod tests {
assert!(config.profile_name.is_none());
assert!(config.profile_avatar_path.is_none());
assert!(config.profile_bio.is_none());
assert_eq!(config.custom_theme_colors, CustomThemeColors::default());
}
#[test]
@@ -204,6 +231,7 @@ mod tests {
profile_name: Some("Test User".to_string()),
profile_avatar_path: None,
profile_bio: Some("A test bio".to_string()),
custom_theme_colors: CustomThemeColors::default(),
};
let json = serde_json::to_string(&config).unwrap();
@@ -232,5 +260,8 @@ mod tests {
serde_json::to_string(&high_contrast).unwrap(),
"\"high-contrast\""
);
let custom = Theme::Custom;
assert_eq!(serde_json::to_string(&custom).unwrap(), "\"custom\"");
}
}