pub enum AdaptiveColor {
Fixed(Color),
Adaptive {
light: Color,
dark: Color,
},
}Expand description
An adaptive color that can change based on light/dark mode.
Variants§
Fixed(Color)
A fixed color that doesn’t change with mode.
Adaptive
A color that adapts to light/dark mode.
Implementations§
Source§impl AdaptiveColor
impl AdaptiveColor
Sourcepub const fn adaptive(light: Color, dark: Color) -> Self
pub const fn adaptive(light: Color, dark: Color) -> Self
Create an adaptive color with light/dark variants.
Sourcepub const fn resolve(&self, is_dark: bool) -> Color
pub const fn resolve(&self, is_dark: bool) -> Color
Resolve the color based on the current mode.
§Arguments
is_dark- true for dark mode, false for light mode
Sourcepub const fn is_adaptive(&self) -> bool
pub const fn is_adaptive(&self) -> bool
Check if this color adapts to mode.
Trait Implementations§
Source§impl Clone for AdaptiveColor
impl Clone for AdaptiveColor
Source§fn clone(&self) -> AdaptiveColor
fn clone(&self) -> AdaptiveColor
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 AdaptiveColor
impl Debug for AdaptiveColor
Source§impl Default for AdaptiveColor
impl Default for AdaptiveColor
Source§impl From<Color> for AdaptiveColor
impl From<Color> for AdaptiveColor
Source§impl PartialEq for AdaptiveColor
impl PartialEq for AdaptiveColor
impl Copy for AdaptiveColor
impl Eq for AdaptiveColor
impl StructuralPartialEq for AdaptiveColor
Auto Trait Implementations§
impl Freeze for AdaptiveColor
impl RefUnwindSafe for AdaptiveColor
impl Send for AdaptiveColor
impl Sync for AdaptiveColor
impl Unpin for AdaptiveColor
impl UnsafeUnpin for AdaptiveColor
impl UnwindSafe for AdaptiveColor
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