Struct css_colors::HSLA

source ·
pub struct HSLA {
    pub h: Angle,
    pub s: Ratio,
    pub l: Ratio,
    pub a: Ratio,
}
Expand description

A struct to represent how much hue, saturation, and luminosity should be added to create a color. Also handles alpha specifications.

A valid value for h must range between 0-360. The saturation ranges between 0-100, where 0 is completely desaturated, and 100 is full saturation. The luminosity ranges between 0-100, where 0 is no light (black), and 100 is full light (white).

For more, see the CSS Color Spec.

Fields

h: Angles: Ratiol: Ratioa: Ratio

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Converts self to its CSS string format. Read more
Converts self into its RGB representation. When converting from a color model that supports an alpha channel (e.g. RGBA), the alpha value will not be preserved. Read more
Converts self into its RGBA representation. When converting from a color model that does not supports an alpha channel (e.g. RGB), it will be treated as fully opaque. Read more
Converts self into its HSL representation. When converting from a color model that supports an alpha channel (e.g. RGBA), the alpha value will not be preserved. Read more
Converts self into its HSLA representation. When converting from a color model that does not supports an alpha channel (e.g. RGB), it will be treated as fully opaque. Read more
Increases the saturation of self by an absolute amount. Operates on the color within its HSL representation and preserves any existing alpha channel. For more, see Less’ Color Operations. Read more
Decreases the saturation of self by an absolute amount. Operates on the color within its HSL representation and preserves any existing alpha channel. For more, see Less’ Color Operations. Read more
Increases the lightness of self by an absolute amount. Operates on the color within its HSL representation and preserves any existing alpha channel. For more, see Less’ Color Operations. Read more
Decreases the lightness of self by an absolute amount. Operates on the color within its HSL representation and preserves any existing alpha channel. For more, see Less’ Color Operations. Read more
Decreases the transparency (or increase the opacity) of self, making it more opaque. For opqaue colors, converts into the alpha equivalent of self, and then increases the opacity. For more, see Less’ Color Operations. Read more
Increases the transparency (or decrease the opacity) of self, making it less opaque. For opqaue colors, converts into the alpha equivalent of self, and then decreases the opacity. For more, see Less’ Color Operations. Read more
Sets the absolute opacity of self, and returns the alpha equivalent. Can be applied to colors whether they already have an opacity value or not. For more, see Less’ Color Operations. Read more
Rotate the hue angle of self in either direction. Returns the appropriate RGB representation of the color once it has been spun. For more, see Less’ Color Operations. Read more
Mixes two colors (self and any other Color) together in variable proportion. Takes opacity into account in the calculations. For more, see Less’ Color Operations. Read more
Mixes self with white in variable proportion. Equivalent to calling mix() with white (rgb(255, 255, 255)). For more, see Less’ Color Operations. Read more
Mixes self with white in variable proportion. Equivalent to calling mix() with black (rgb(0, 0, 0)). For more, see Less’ Color Operations. Read more
Remove all saturation from self in the HSL color space. Equivalent to calling desaturate(0) on a color. For more, see Less’ Color Operations. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.