pub struct Theme {
pub background: Color,
pub card_background: Color,
pub card_border: Color,
pub text_primary: Color,
pub text_secondary: Color,
pub badge_background: Color,
pub badge_text: Color,
pub badge_matched_background: Color,
pub badge_matched_text: Color,
pub border_width: f32,
pub corner_radius: f32,
}Expand description
Theme for overlay rendering
Fields§
§background: ColorBackground overlay color (semi-transparent)
card_background: ColorCard background color
card_border: ColorCard border color
text_primary: ColorPrimary text color
text_secondary: ColorSecondary text color (for titles)
badge_background: ColorHint badge background
badge_text: ColorHint badge text color
badge_matched_background: ColorMatched hint badge background
badge_matched_text: ColorMatched hint badge text color
border_width: f32Border width
corner_radius: f32Corner radius
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn from_cosmic() -> Option<Self>
pub fn from_cosmic() -> Option<Self>
Create a theme from COSMIC desktop configuration
This provides native integration with COSMIC’s theming system, automatically matching dark/light mode and accent colors.
COSMIC uses a layered color system with guaranteed contrast:
- Container level (base/on): For surfaces -
oncontrasts withbase - Component level (component.base/on): For buttons/inputs inside containers
The overlay popup implements a “primary” container pattern:
- primary.base for the card background
- primary.on for text (designed for contrast on primary.base)
- primary.component.* for badge elements (interactive-like)
- accent.* for highlights and matched states
Sourcepub fn from_config(config: &Config) -> Self
pub fn from_config(config: &Config) -> Self
Create a theme from user configuration
This is used when COSMIC theme is not available or when user has explicit color overrides in their config.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.