#[non_exhaustive]pub struct ThemeVariant {
pub colors: ThemeColors,
pub fonts: ThemeFonts,
pub geometry: ThemeGeometry,
pub spacing: ThemeSpacing,
pub widget_metrics: Option<WidgetMetrics>,
pub icon_set: Option<String>,
}Expand description
A single light or dark theme variant containing all visual properties.
Composes colors, fonts, geometry, and spacing into one coherent set. Empty sub-structs are omitted from serialization to keep TOML files clean.
§Examples
use native_theme::{ThemeVariant, Rgba};
let mut variant = ThemeVariant::default();
variant.colors.accent = Some(Rgba::rgb(0, 120, 215));
variant.fonts.family = Some("Inter".into());
assert!(!variant.is_empty());Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.colors: ThemeColors§fonts: ThemeFonts§geometry: ThemeGeometry§spacing: ThemeSpacing§widget_metrics: Option<WidgetMetrics>Per-widget sizing and spacing metrics.
Optional because not all themes or presets provide widget metrics. When merging, if both base and overlay have widget metrics they are merged recursively; if only the overlay has them they are cloned.
icon_set: Option<String>Icon set / naming convention for this variant (e.g., “sf-symbols”, “freedesktop”). When None, resolved at runtime via system_icon_set().
Implementations§
Source§impl ThemeVariant
impl ThemeVariant
Trait Implementations§
Source§impl Clone for ThemeVariant
impl Clone for ThemeVariant
Source§fn clone(&self) -> ThemeVariant
fn clone(&self) -> ThemeVariant
Returns a duplicate of the value. Read more
1.0.0 · 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 ThemeVariant
impl Debug for ThemeVariant
Source§impl Default for ThemeVariant
impl Default for ThemeVariant
Source§fn default() -> ThemeVariant
fn default() -> ThemeVariant
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ThemeVariantwhere
ThemeVariant: Default,
impl<'de> Deserialize<'de> for ThemeVariantwhere
ThemeVariant: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ThemeVariant
impl PartialEq for ThemeVariant
Source§impl Serialize for ThemeVariant
impl Serialize for ThemeVariant
impl StructuralPartialEq for ThemeVariant
Auto Trait Implementations§
impl Freeze for ThemeVariant
impl RefUnwindSafe for ThemeVariant
impl Send for ThemeVariant
impl Sync for ThemeVariant
impl Unpin for ThemeVariant
impl UnsafeUnpin for ThemeVariant
impl UnwindSafe for ThemeVariant
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