pub enum ThemeChoice {
Auto,
Dark,
Light,
}Expand description
User-visible theme preference, stored in the config file as a string
("auto", "dark", "light"). A string is used on disk so older
configs (and hand-edited files with typos) keep loading; unknown
values silently fall back to ThemeChoice::Auto.
Variants§
Auto
Follow the OS appearance via detect.
Dark
Force dark theme regardless of OS.
Light
Force light theme regardless of OS.
Implementations§
Source§impl ThemeChoice
impl ThemeChoice
Sourcepub fn from_config_str(s: &str) -> Self
pub fn from_config_str(s: &str) -> Self
Parse from the on-disk config string. Unknown values fall back
to Self::Auto (no panic, no error) so a malformed file
degrades gracefully.
pub fn as_str(self) -> &'static str
Sourcepub fn resolve(self, os_hint: Appearance) -> Appearance
pub fn resolve(self, os_hint: Appearance) -> Appearance
Resolve to a concrete Appearance given an OS detection.
Auto uses the OS hint (falling back to Appearance::Dark
when the OS is silent); explicit choices always win.
Trait Implementations§
Source§impl Clone for ThemeChoice
impl Clone for ThemeChoice
Source§fn clone(&self) -> ThemeChoice
fn clone(&self) -> ThemeChoice
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThemeChoice
impl Debug for ThemeChoice
Source§impl Default for ThemeChoice
impl Default for ThemeChoice
Source§fn default() -> ThemeChoice
fn default() -> ThemeChoice
Returns the “default value” for a type. Read more
Source§impl PartialEq for ThemeChoice
impl PartialEq for ThemeChoice
Source§fn eq(&self, other: &ThemeChoice) -> bool
fn eq(&self, other: &ThemeChoice) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ThemeChoice
impl Eq for ThemeChoice
impl StructuralPartialEq for ThemeChoice
Auto Trait Implementations§
impl Freeze for ThemeChoice
impl RefUnwindSafe for ThemeChoice
impl Send for ThemeChoice
impl Sync for ThemeChoice
impl Unpin for ThemeChoice
impl UnsafeUnpin for ThemeChoice
impl UnwindSafe for ThemeChoice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more