logo
#[repr(C)]
pub struct Color { pub red: f32, pub green: f32, pub blue: f32, pub alpha: f32, }
Expand description

Basic color representation

Fields

red: f32

Red component

green: f32

Green component

blue: f32

Blue component

alpha: f32

Alpha component

Implementations

Create color with floating point components

Create solid color with byte components

Create color with byte components

Create solid color with using hsl color space

Create solid color with using hsl color space and alpha component

Create solid color with using hsv color space

Create solid color with using hsv color space and alpha component

Create solid color with using cmyk color space

Create solid color with using cmyk color space and alpha component

Create solid color with using cmy color space

Create solid color with using cmy color space and alpha component

👎 Deprecated

Create solid color with using rgb color space

👎 Deprecated

Create solid color with using lab rgb space and alpha component

👎 Deprecated

Create solid color with using hsl color space

👎 Deprecated

Create solid color with using hsv color space

👎 Deprecated

Create solid color with using cmyk color space

👎 Deprecated

Create solid color with using cmy color space

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Retrieve the alpha component

Retrieve the alpha component as opacity

Retrieve the alpha component as transparency

Retrieve the color component

Set the color component

Retrieve the color and aplha components

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Create color with rounded values

Set the alpha component

Set the alpha component as opacity

Set the alpha component as transparency

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.