Struct bracket_terminal::prelude::RGBA[][src]

pub struct RGBA {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}
Expand description

Represents an R/G/B triplet, in the range 0..1 (32-bit float)

Fields

r: f32g: f32b: f32a: f32

Implementations

Constructs a new, zeroed (black) RGB triplet.

Constructs a new RGB color, from 3 32-bit floats in the range 0..1

Constructs a new RGB color, from 3 bytes in the range 0..255

Construct an RGB color from a tuple of u8, or a named constant

Constructs from an HTML color code (e.g. “#eeffeeff”)

Errors

Converts to an RGB, dropping the alpha component

Applies a quick grayscale conversion to the color

Applies a lengthier desaturate (via HSV) to the color

Lerps by a specified percentage (from 0 to 1) between this color and another

Lerps only the alpha channel, by a specified percentage (from 0 to 1) between this color and another

Converts an RGB to an xp file color component

Trait Implementations

Support adding an RGB to a color. The result is clamped via the constructor.

The resulting type after applying the + operator.

Performs the + operation. Read more

Support adding a float to a color. The result is clamped via the constructor.

The resulting type after applying the + operator.

Performs the + operation. Read more

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

Support conversion from a color tuple

Performs the conversion.

Support conversion from a color tuple

Performs the conversion.

Support conversion from HSV

Performs the conversion.

Support conversion from RGB

Performs the conversion.

Support conversion from RGBA

Performs the conversion.

Support conversion from RGBA

Performs the conversion.

Support multiplying a color by another color. The result is clamped via the constructor.

The resulting type after applying the * operator.

Performs the * operation. Read more

Support multiplying a color by a float. The result is clamped via the constructor.

The resulting type after applying the * operator.

Performs the * operation. Read more

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

This method tests for !=.

Support subtracting an RGB from a color. The result is clamped via the constructor.

The resulting type after applying the - operator.

Performs the - operation. Read more

Support subtracting a float from a color. The result is clamped via the constructor.

The resulting type after applying the - operator.

Performs the - operation. 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

Performs the conversion.

Performs the conversion.

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.