Enum flo_canvas::Color
source · pub enum Color {
Rgba(f32, f32, f32, f32),
Hsluv(f32, f32, f32, f32),
}
Expand description
Representation of a colour
Variants§
Implementations§
source§impl Color
impl Color
sourcepub fn to_rgba_components(&self) -> (f32, f32, f32, f32)
pub fn to_rgba_components(&self) -> (f32, f32, f32, f32)
Returns this colour as RGBA components
sourcepub fn to_hsluv_components(&self) -> (f32, f32, f32, f32)
pub fn to_hsluv_components(&self) -> (f32, f32, f32, f32)
Returns this colour as HSLUV components
sourcepub fn to_format(&self, format: ColorFormat) -> Color
pub fn to_format(&self, format: ColorFormat) -> Color
Converts this colour to another format
sourcepub fn with_alpha(&self, new_alpha: f32) -> Color
pub fn with_alpha(&self, new_alpha: f32) -> Color
Returns a new colour that’s the same as this one except with a different alpha value
Trait Implementations§
source§impl CanvasEncoding<String> for Color
impl CanvasEncoding<String> for Color
source§fn encode_canvas(&self, append_to: &mut String)
fn encode_canvas(&self, append_to: &mut String)
Encodes this item by appending it to the specified string
source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
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