pub struct Theme {
pub background: Color,
pub foreground: Color,
pub default_widgets: DefaultTheme,
pub extensions: ThemeExtensions,
}Expand description
Application-level colors, built-in widget theme, and custom extensions.
Fields§
§background: ColorDefault application background color.
foreground: ColorDefault application foreground color.
default_widgets: DefaultThemeTheme used by SUI’s built-in widgets.
extensions: ThemeExtensionsType-indexed application theme extensions.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn with_default_widgets(self, theme: DefaultTheme) -> Self
pub fn with_default_widgets(self, theme: DefaultTheme) -> Self
Replace the theme used by built-in widgets.
Sourcepub fn with_extension<T>(self, value: T) -> Selfwhere
T: ThemeExtension,
pub fn with_extension<T>(self, value: T) -> Selfwhere
T: ThemeExtension,
Add a typed extension using builder syntax.
Sourcepub fn insert_extension<T>(&mut self, value: T) -> Option<Arc<T>>where
T: ThemeExtension,
pub fn insert_extension<T>(&mut self, value: T) -> Option<Arc<T>>where
T: ThemeExtension,
Insert or replace a typed theme extension.
Sourcepub fn extension<T>(&self) -> Option<&T>where
T: ThemeExtension,
pub fn extension<T>(&self) -> Option<&T>where
T: ThemeExtension,
Borrow a typed theme extension.
Sourcepub fn extension_arc<T>(&self) -> Option<Arc<T>>where
T: ThemeExtension,
pub fn extension_arc<T>(&self) -> Option<Arc<T>>where
T: ThemeExtension,
Clone the shared pointer for a typed theme extension.
Sourcepub fn has_extension<T>(&self) -> boolwhere
T: ThemeExtension,
pub fn has_extension<T>(&self) -> boolwhere
T: ThemeExtension,
Return whether a typed theme extension is present.
Sourcepub fn remove_extension<T>(&mut self) -> Option<Arc<T>>where
T: ThemeExtension,
pub fn remove_extension<T>(&mut self) -> Option<Arc<T>>where
T: ThemeExtension,
Remove and return a typed theme extension.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Theme
impl !UnwindSafe for Theme
impl Forget for Theme
impl Freeze for Theme
impl Move for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.