pub struct Theme {
pub mode: ThemeMode,
pub colors: ThemeColor,
pub metrics: ThemeMetrics,
}Expand description
The full theme: colors + metrics + mode flag.
Fields§
§mode: ThemeMode§colors: ThemeColor§metrics: ThemeMetricsImplementations§
Source§impl Theme
impl Theme
pub const fn light() -> Self
pub const fn dark() -> Self
pub fn corner(&self) -> CornerRadius
pub fn corner_sm(&self) -> CornerRadius
pub fn corner_lg(&self) -> CornerRadius
pub fn border_stroke(&self) -> Stroke
pub fn focus_ring(&self) -> Stroke
pub fn input_border_stroke(&self) -> Stroke
Sourcepub fn apply_to_style(&self, style: &mut Style)
pub fn apply_to_style(&self, style: &mut Style)
Push the theme’s typography / colors into the supplied egui::Style.
Components do not require this — they read Theme directly via
Self::install so they look correct even when the host app uses its
own egui style. This is a convenience that makes plain egui::Label
and built-in widgets blend in with the theme palette.
Sourcepub fn install(self, ctx: &Context)
pub fn install(self, ctx: &Context)
Convenience: install into the active egui::Context and stash the
theme in ctx.data so any component can fetch it via Theme::get.
Sourcepub fn get(ctx: &Context) -> Self
pub fn get(ctx: &Context) -> Self
Fetch the installed theme — or fall back to Theme::light() if the
host never called Self::install.
Trait Implementations§
impl Copy for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin 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