pub enum ColorFunction {
Rgb {
r: u8,
g: u8,
b: u8,
alpha: Option<f32>,
},
Hsl {
h: u16,
s: u8,
l: u8,
alpha: Option<f32>,
},
Oklch {
l: f32,
c: f32,
h: f32,
alpha: Option<f32>,
},
Lab {
l: f32,
a: f32,
b: f32,
alpha: Option<f32>,
},
Lch {
l: f32,
c: f32,
h: f32,
alpha: Option<f32>,
},
}Expand description
CSS color function types
Variants§
Rgb
RGB color function: rgb(255, 0, 0)
Hsl
HSL color function: hsl(0, 100%, 50%)
Oklch
OKLCH color function: oklch(0.7 0.15 0)
Lab
LAB color function: lab(70% 0 0)
Lch
LCH color function: lch(70% 0 0)
Implementations§
Source§impl ColorFunction
impl ColorFunction
Sourcepub fn rgba(r: u8, g: u8, b: u8, alpha: f32) -> ColorFunction
pub fn rgba(r: u8, g: u8, b: u8, alpha: f32) -> ColorFunction
Create a new RGB color function with alpha
Sourcepub fn hsla(h: u16, s: u8, l: u8, alpha: f32) -> ColorFunction
pub fn hsla(h: u16, s: u8, l: u8, alpha: f32) -> ColorFunction
Create a new HSL color function with alpha
Sourcepub fn oklcha(l: f32, c: f32, h: f32, alpha: f32) -> ColorFunction
pub fn oklcha(l: f32, c: f32, h: f32, alpha: f32) -> ColorFunction
Create a new OKLCH color function with alpha
Sourcepub fn to_css_value(&self) -> String
pub fn to_css_value(&self) -> String
Convert to CSS value
Sourcepub fn to_class_name(&self) -> String
pub fn to_class_name(&self) -> String
Convert to class name
Trait Implementations§
Source§impl Clone for ColorFunction
impl Clone for ColorFunction
Source§fn clone(&self) -> ColorFunction
fn clone(&self) -> ColorFunction
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 ColorFunction
impl Debug for ColorFunction
Source§impl<'de> Deserialize<'de> for ColorFunction
impl<'de> Deserialize<'de> for ColorFunction
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ColorFunction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ColorFunction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ColorFunction
impl Display for ColorFunction
Source§impl PartialEq for ColorFunction
impl PartialEq for ColorFunction
Source§impl Serialize for ColorFunction
impl Serialize for ColorFunction
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ColorFunction
Auto Trait Implementations§
impl Freeze for ColorFunction
impl RefUnwindSafe for ColorFunction
impl Send for ColorFunction
impl Sync for ColorFunction
impl Unpin for ColorFunction
impl UnwindSafe for ColorFunction
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.