Skip to main content

Hsla

Type Alias Hsla 

Source
pub type Hsla<S = Srgb, T = f32> = Alpha<Hsl<S, T>, T>;
Expand description

Linear HSL with an alpha component. See the Hsla implementation in Alpha.

Aliased Type§

#[repr(C)]
pub struct Hsla<S = Srgb, T = f32> { pub color: Hsl<S, T>, pub alpha: T, }

Fields§

§color: Hsl<S, T>

The color.

§alpha: T

The transparency component. 0.0 (or 0u8) is fully transparent and 1.0 (or 255u8) is fully opaque.

Trait Implementations§

Source§

impl ColorExt for Hsla

Source§

fn blend(&self, other: &Self) -> Self

Performs a SrcAlpha x (1 - SrcAlpha) blend
Source§

fn fade_out(&mut self, factor: f32)

Fade out the color by a given factor. This factor should be between 0.0 and 1.0. Where 0.0 will leave the color unchanged, and 1.0 will completely fade out the color.
Source§

fn opacity(&self, factor: f32) -> Self

Multiplies the alpha value of the color by a given factor and returns a new color. If the color was previously opaque, then this is equivalent to with_alpha. Read more