Enum nannou::ui::prelude::color::Color[][src]

pub enum Color {
    Rgba(f32f32f32f32),
    Hsla(f32f32f32f32),
}
Expand description

Color supporting RGB and HSL variants.

Variants

Rgba(f32f32f32f32)

Red, Green, Blue, Alpha - All values’ scales represented between 0.0 and 1.0.

Hsla(f32f32f32f32)

Hue, Saturation, Lightness, Alpha - all values scales represented between 0.0 and 1.0.

Implementations

Produce a complementary color. The two colors will accent each other. This is the same as rotating the hue by 180 degrees.

Calculate and return the luminance of the Color.

Return either black or white, depending which contrasts the Color the most. This will be useful for determining a readable color for text on any given background Color.

Extract the components of a color in the HSL format.

Extract the components of a color in the RGB format.

Extract the components of a color in the RGB format within a fixed-size array.

Same as to_fsa, except r, g, b and a are represented in byte form.

Return the same color but with the given luminance.

Return the same color but with the alpha multiplied by the given alpha.

Return the same color but with the given alpha.

Return a highlighted version of the current Color.

Return a clicked version of the current Color.

Return the Color’s invert.

Return the red value.

Return the green value.

Return the blue value.

Set the red value.

Set the green value.

Set the blue value.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert into T with values clamped to the color defined bounds Read more

Convert into T. The resulting color might be invalid in its color space Read more

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. 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.