#[repr(C, u8)]pub enum ColorOrSystem {
Color(ColorU),
System(SystemColorRef),
}Expand description
A color reference that can be either a concrete color or a system color. System colors are lazily evaluated at runtime based on the user’s system theme.
CSS syntax: system:accent, system:text, system:background, etc.
Variants§
Color(ColorU)
A concrete RGBA color value.
System(SystemColorRef)
A reference to a system color, resolved at runtime.
Implementations§
Source§impl ColorOrSystem
impl ColorOrSystem
Sourcepub const fn system(s: SystemColorRef) -> Self
pub const fn system(s: SystemColorRef) -> Self
Create a new ColorOrSystem from a system color reference.
Sourcepub fn resolve(&self, system_colors: &SystemColors, fallback: ColorU) -> ColorU
pub fn resolve(&self, system_colors: &SystemColors, fallback: ColorU) -> ColorU
Resolve the color against a SystemColors struct. Returns the system color if available, or falls back to the provided default.
Sourcepub fn to_color_u_with_fallback(&self, fallback: ColorU) -> ColorU
pub fn to_color_u_with_fallback(&self, fallback: ColorU) -> ColorU
Returns the concrete color if available, or a default fallback for system colors. Use this when SystemColors is not available (e.g., during rendering setup).
Sourcepub fn to_color_u_default(&self) -> ColorU
pub fn to_color_u_default(&self) -> ColorU
Returns the concrete color if available, or a gray fallback for system colors.
Trait Implementations§
Source§impl Clone for ColorOrSystem
impl Clone for ColorOrSystem
Source§fn clone(&self) -> ColorOrSystem
fn clone(&self) -> ColorOrSystem
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 ColorOrSystem
impl Debug for ColorOrSystem
Source§impl Default for ColorOrSystem
impl Default for ColorOrSystem
Source§impl From<ColorU> for ColorOrSystem
impl From<ColorU> for ColorOrSystem
Source§impl Hash for ColorOrSystem
impl Hash for ColorOrSystem
Source§impl Ord for ColorOrSystem
impl Ord for ColorOrSystem
Source§fn cmp(&self, other: &ColorOrSystem) -> Ordering
fn cmp(&self, other: &ColorOrSystem) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ColorOrSystem
impl PartialEq for ColorOrSystem
Source§impl PartialOrd for ColorOrSystem
impl PartialOrd for ColorOrSystem
impl Copy for ColorOrSystem
impl Eq for ColorOrSystem
impl StructuralPartialEq for ColorOrSystem
Auto Trait Implementations§
impl Freeze for ColorOrSystem
impl RefUnwindSafe for ColorOrSystem
impl Send for ColorOrSystem
impl Sync for ColorOrSystem
impl Unpin for ColorOrSystem
impl UnsafeUnpin for ColorOrSystem
impl UnwindSafe for ColorOrSystem
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