feat(accessibility): add high-contrast display modes
Acceptance Criteria:\n- Users can toggle high-contrast and reduced-chrome modes via :accessibility commands.\n- Accessibility flags persist in config and update UI header legends without restart.\n- Reduced chrome removes glass shadows while preserving layout readability. Test Notes:\n- cargo test -p owlen-tui
This commit is contained in:
@@ -17,7 +17,7 @@ use std::time::Duration;
|
||||
pub const DEFAULT_CONFIG_PATH: &str = "~/.config/owlen/config.toml";
|
||||
|
||||
/// Current schema version written to `config.toml`.
|
||||
pub const CONFIG_SCHEMA_VERSION: &str = "1.6.0";
|
||||
pub const CONFIG_SCHEMA_VERSION: &str = "1.7.0";
|
||||
|
||||
/// Provider config key for forcing Ollama provider mode.
|
||||
pub const OLLAMA_MODE_KEY: &str = "ollama_mode";
|
||||
@@ -1814,6 +1814,35 @@ pub struct UiSettings {
|
||||
pub keymap_profile: Option<String>,
|
||||
#[serde(default)]
|
||||
pub keymap_path: Option<String>,
|
||||
#[serde(default)]
|
||||
pub accessibility: AccessibilitySettings,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AccessibilitySettings {
|
||||
#[serde(default = "AccessibilitySettings::default_high_contrast")]
|
||||
pub high_contrast: bool,
|
||||
#[serde(default = "AccessibilitySettings::default_reduced_chrome")]
|
||||
pub reduced_chrome: bool,
|
||||
}
|
||||
|
||||
impl AccessibilitySettings {
|
||||
const fn default_high_contrast() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
const fn default_reduced_chrome() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for AccessibilitySettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
high_contrast: Self::default_high_contrast(),
|
||||
reduced_chrome: Self::default_reduced_chrome(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Preference for which symbol set to render in the terminal UI.
|
||||
@@ -1957,6 +1986,7 @@ impl Default for UiSettings {
|
||||
icon_mode: Self::default_icon_mode(),
|
||||
keymap_profile: Self::default_keymap_profile(),
|
||||
keymap_path: None,
|
||||
accessibility: AccessibilitySettings::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2384,6 +2414,13 @@ mod tests {
|
||||
assert_eq!(cloud.api_key_env.as_deref(), Some(OLLAMA_API_KEY_ENV));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_ui_accessibility_flags_off() {
|
||||
let config = Config::default();
|
||||
assert!(!config.ui.accessibility.high_contrast);
|
||||
assert!(!config.ui.accessibility.reduced_chrome);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_provider_config_aliases_cloud_defaults() {
|
||||
let mut config = Config::default();
|
||||
|
||||
Reference in New Issue
Block a user