[][src]Struct coffee::graphics::Color

pub struct Color {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}

An RGBA color in the sRGB color space.

Fields

r: f32

Red component.

g: f32

Green component.

b: f32

Blue component.

a: f32

Alpha component.

Implementations

impl Color[src]

pub const WHITE: Self[src]

White color.

pub const BLACK: Self[src]

Black color.

pub const RED: Self[src]

Red color.

pub const GREEN: Self[src]

Green color.

pub const BLUE: Self[src]

Blue color.

pub fn new(r: f32, g: f32, b: f32, a: f32) -> Color[src]

Creates a new Color from components in the [0, 1.0] range.

pub fn from_rgb(r: u8, g: u8, b: u8) -> Color[src]

Creates a new Color from its RGB components in the [0, 255] range.

pub fn from_rgb_u32(color: u32) -> Color[src]

Creates a new Color from its RGB representation (0xRRGGBB).

pub fn to_rgba(&self) -> [u8; 4][src]

Returns the Color components in the [0, 255] range.

Trait Implementations

impl Clone for Color[src]

impl Copy for Color[src]

impl Debug for Color[src]

impl From<[u8; 3]> for Color[src]

impl From<Color> for [f32; 4][src]

impl From<Color> for [u8; 4][src]

impl PartialEq<Color> for Color[src]

impl StructuralPartialEq for Color[src]

Auto Trait Implementations

impl RefUnwindSafe for Color

impl Send for Color

impl Sync for Color

impl Unpin for Color

impl UnwindSafe for Color

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

impl<T> SetParameter for T

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,