pub struct ThemeSelectorState { /* private fields */ }Expand description
Owned state for the theme selector. Create on open, drop on close.
Implementations§
Source§impl ThemeSelectorState
impl ThemeSelectorState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new selector state, populating from all available themes.
Themes are sorted dark-first, then alphabetically within each variant. All themes are pre-loaded into memory for instant preview.
Sourcepub fn with_current_selected() -> Self
pub fn with_current_selected() -> Self
Create a new selector with the currently active theme pre-selected.
Sourcepub fn with_derive(self, derive: fn(&mut Theme)) -> Self
pub fn with_derive(self, derive: fn(&mut Theme)) -> Self
Set the app-level token derivation callback for live preview.
This function is called on each cached theme clone before it’s applied as the global theme, allowing apps to register their derived tokens.
Sourcepub fn handle_key(&mut self, key: KeyEvent) -> ThemeSelectorAction
pub fn handle_key(&mut self, key: KeyEvent) -> ThemeSelectorAction
Handle a key event. Returns the action taken.
Sourcepub fn selected_theme(&self) -> Option<&ThemeInfo>
pub fn selected_theme(&self) -> Option<&ThemeInfo>
The currently selected theme info, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThemeSelectorState
impl RefUnwindSafe for ThemeSelectorState
impl Send for ThemeSelectorState
impl Sync for ThemeSelectorState
impl Unpin for ThemeSelectorState
impl UnsafeUnpin for ThemeSelectorState
impl UnwindSafe for ThemeSelectorState
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more