Color

Struct Color 

Source
#[repr(C)]
pub struct Color { pub r: f32, pub g: f32, pub b: f32, pub a: f32, }
Expand description

Describes the red, green, blue, and alpha components of a color.

Fields§

§r: f32

Red channel [0.0, 1.0]

§g: f32

Green channel [0.0, 1.0]

§b: f32

Blue channel [0.0, 1.0]

§a: f32

Alpha channel [0.0, 1.0]

Implementations§

Source§

impl Color

Source

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

Construct a color from its floating components

Source

pub fn from_u32(rgb: u32, a: f32) -> Color

Construct a color from its hexidecimal RGB color and floating point alpha channel. rgb is interpreted as 0xRRGGBB

Source

pub fn lerp(&self, other: &Color, t: f32) -> Color

Linearly interpolate between two colors. 0.0 will return self as-is and 1.0 will return other as-is.

Source§

impl Color

Source

pub const ALICE_BLUE: Color = ALICE_BLUE

Source

pub const ANTIQUE_WHITE: Color = ANTIQUE_WHITE

Source

pub const AQUA: Color = AQUA

Source

pub const AQUAMARINE: Color = AQUAMARINE

Source

pub const AZURE: Color = AZURE

Source

pub const BEIGE: Color = BEIGE

Source

pub const BISQUE: Color = BISQUE

Source

pub const BLACK: Color = BLACK

Source

pub const BLANCHED_ALMOND: Color = BLANCHED_ALMOND

Source

pub const BLUE: Color = BLUE

Source

pub const BLUE_VIOLET: Color = BLUE_VIOLET

Source

pub const BROWN: Color = BROWN

Source

pub const BURLY_WOOD: Color = BURLY_WOOD

Source

pub const CADET_BLUE: Color = CADET_BLUE

Source

pub const CHARTREUSE: Color = CHARTREUSE

Source

pub const CHOCOLATE: Color = CHOCOLATE

Source

pub const CORAL: Color = CORAL

Source

pub const CORNFLOWER_BLUE: Color = CORNFLOWER_BLUE

Source

pub const CORNSILK: Color = CORNSILK

Source

pub const CRIMSON: Color = CRIMSON

Source

pub const CYAN: Color = CYAN

Source

pub const DARK_BLUE: Color = DARK_BLUE

Source

pub const DARK_CYAN: Color = DARK_CYAN

Source

pub const DARK_GOLDENROD: Color = DARK_GOLDENROD

Source

pub const DARK_GRAY: Color = DARK_GRAY

Source

pub const DARK_GREEN: Color = DARK_GREEN

Source

pub const DARK_KHAKI: Color = DARK_KHAKI

Source

pub const DARK_MAGENTA: Color = DARK_MAGENTA

Source

pub const DARK_OLIVEGREEN: Color = DARK_OLIVEGREEN

Source

pub const DARK_ORANGE: Color = DARK_ORANGE

Source

pub const DARK_ORCHID: Color = DARK_ORCHID

Source

pub const DARK_RED: Color = DARK_RED

Source

pub const DARK_SALMON: Color = DARK_SALMON

Source

pub const DARK_SEAGREEN: Color = DARK_SEAGREEN

Source

pub const DARK_SLATEBLUE: Color = DARK_SLATEBLUE

Source

pub const DARK_SLATEGRAY: Color = DARK_SLATEGRAY

Source

pub const DARK_TURQUOISE: Color = DARK_TURQUOISE

Source

pub const DARK_VIOLET: Color = DARK_VIOLET

Source

pub const DEEP_PINK: Color = DEEP_PINK

Source

pub const DEEP_SKYBLUE: Color = DEEP_SKYBLUE

Source

pub const DIM_GRAY: Color = DIM_GRAY

Source

pub const DODGER_BLUE: Color = DODGER_BLUE

Source

pub const FIREBRICK: Color = FIREBRICK

Source

pub const FLORAL_WHITE: Color = FLORAL_WHITE

Source

pub const FOREST_GREEN: Color = FOREST_GREEN

Source

pub const FUCHSIA: Color = FUCHSIA

Source

pub const GAINSBORO: Color = GAINSBORO

Source

pub const GHOST_WHITE: Color = GHOST_WHITE

Source

pub const GOLD: Color = GOLD

Source

pub const GOLDENROD: Color = GOLDENROD

Source

pub const GRAY: Color = GRAY

Source

pub const GREEN: Color = GREEN

Source

pub const GREEN_YELLOW: Color = GREEN_YELLOW

Source

pub const HONEYDEW: Color = HONEYDEW

Source

pub const HOT_PINK: Color = HOT_PINK

Source

pub const INDIAN_RED: Color = INDIAN_RED

Source

pub const INDIGO: Color = INDIGO

Source

pub const IVORY: Color = IVORY

Source

pub const KHAKI: Color = KHAKI

Source

pub const LAVENDER: Color = LAVENDER

Source

pub const LAVENDER_BLUSH: Color = LAVENDER_BLUSH

Source

pub const LAWN_GREEN: Color = LAWN_GREEN

Source

pub const LEMON_CHIFFON: Color = LEMON_CHIFFON

Source

pub const LIGHT_BLUE: Color = LIGHT_BLUE

Source

pub const LIGHT_CORAL: Color = LIGHT_CORAL

Source

pub const LIGHT_CYAN: Color = LIGHT_CYAN

Source

pub const LIGHT_GOLDENRODYELLOW: Color = LIGHT_GOLDENRODYELLOW

Source

pub const LIGHT_GREEN: Color = LIGHT_GREEN

Source

pub const LIGHT_GRAY: Color = LIGHT_GRAY

Source

pub const LIGHT_PINK: Color = LIGHT_PINK

Source

pub const LIGHT_SALMON: Color = LIGHT_SALMON

Source

pub const LIGHT_SEAGREEN: Color = LIGHT_SEAGREEN

Source

pub const LIGHT_SKYBLUE: Color = LIGHT_SKYBLUE

Source

pub const LIGHT_SLATEGRAY: Color = LIGHT_SLATEGRAY

Source

pub const LIGHT_STEELBLUE: Color = LIGHT_STEELBLUE

Source

pub const LIGHT_YELLOW: Color = LIGHT_YELLOW

Source

pub const LIME: Color = LIME

Source

pub const LIME_GREEN: Color = LIME_GREEN

Source

pub const LINEN: Color = LINEN

Source

pub const MAGENTA: Color = MAGENTA

Source

pub const MAROON: Color = MAROON

Source

pub const MEDIUM_AQUAMARINE: Color = MEDIUM_AQUAMARINE

Source

pub const MEDIUM_BLUE: Color = MEDIUM_BLUE

Source

pub const MEDIUM_ORCHID: Color = MEDIUM_ORCHID

Source

pub const MEDIUM_PURPLE: Color = MEDIUM_PURPLE

Source

pub const MEDIUM_SEAGREEN: Color = MEDIUM_SEAGREEN

Source

pub const MEDIUM_SLATEBLUE: Color = MEDIUM_SLATEBLUE

Source

pub const MEDIUM_SPRINGGREEN: Color = MEDIUM_SPRINGGREEN

Source

pub const MEDIUM_TURQUOISE: Color = MEDIUM_TURQUOISE

Source

pub const MEDIUM_VIOLETRED: Color = MEDIUM_VIOLETRED

Source

pub const MIDNIGHT_BLUE: Color = MIDNIGHT_BLUE

Source

pub const MINT_CREAM: Color = MINT_CREAM

Source

pub const MISTY_ROSE: Color = MISTY_ROSE

Source

pub const MOCCASIN: Color = MOCCASIN

Source

pub const NAVAJO_WHITE: Color = NAVAJO_WHITE

Source

pub const NAVY: Color = NAVY

Source

pub const OLD_LACE: Color = OLD_LACE

Source

pub const OLIVE: Color = OLIVE

Source

pub const OLIVE_DRAB: Color = OLIVE_DRAB

Source

pub const ORANGE: Color = ORANGE

Source

pub const ORANGE_RED: Color = ORANGE_RED

Source

pub const ORCHID: Color = ORCHID

Source

pub const PALE_GOLDENROD: Color = PALE_GOLDENROD

Source

pub const PALE_GREEN: Color = PALE_GREEN

Source

pub const PALE_TURQUOISE: Color = PALE_TURQUOISE

Source

pub const PALE_VIOLETRED: Color = PALE_VIOLETRED

Source

pub const PAPAYA_WHIP: Color = PAPAYA_WHIP

Source

pub const PEACH_PUFF: Color = PEACH_PUFF

Source

pub const PERU: Color = PERU

Source

pub const PINK: Color = PINK

Source

pub const PLUM: Color = PLUM

Source

pub const POWDER_BLUE: Color = POWDER_BLUE

Source

pub const PURPLE: Color = PURPLE

Source

pub const RED: Color = RED

Source

pub const ROSY_BROWN: Color = ROSY_BROWN

Source

pub const ROYAL_BLUE: Color = ROYAL_BLUE

Source

pub const SADDLE_BROWN: Color = SADDLE_BROWN

Source

pub const SALMON: Color = SALMON

Source

pub const SANDY_BROWN: Color = SANDY_BROWN

Source

pub const SEA_GREEN: Color = SEA_GREEN

Source

pub const SEA_SHELL: Color = SEA_SHELL

Source

pub const SIENNA: Color = SIENNA

Source

pub const SILVER: Color = SILVER

Source

pub const SKY_BLUE: Color = SKY_BLUE

Source

pub const SLATE_BLUE: Color = SLATE_BLUE

Source

pub const SLATE_GRAY: Color = SLATE_GRAY

Source

pub const SNOW: Color = SNOW

Source

pub const SPRING_GREEN: Color = SPRING_GREEN

Source

pub const STEEL_BLUE: Color = STEEL_BLUE

Source

pub const TAN: Color = TAN

Source

pub const TEAL: Color = TEAL

Source

pub const THISTLE: Color = THISTLE

Source

pub const TOMATO: Color = TOMATO

Source

pub const TURQUOISE: Color = TURQUOISE

Source

pub const VIOLET: Color = VIOLET

Source

pub const WHEAT: Color = WHEAT

Source

pub const WHITE: Color = WHITE

Source

pub const WHITE_SMOKE: Color = WHITE_SMOKE

Source

pub const YELLOW: Color = YELLOW

Source

pub const YELLOW_GREEN: Color = YELLOW_GREEN

Trait Implementations§

Source§

impl Clone for Color

Source§

fn clone(&self) -> Color

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Color

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Color

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Color

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a Color> for Color

Source§

fn from(color: &'a Color) -> Color

Converts to this type from the input type.
Source§

impl From<(u32, f32)> for Color

Source§

fn from((rgb, a): (u32, f32)) -> Color

Converts to this type from the input type.
Source§

impl From<u32> for Color

Source§

fn from(rgb: u32) -> Color

Converts to this type from the input type.
Source§

impl PartialEq for Color

Source§

fn eq(&self, other: &Color) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Color

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Color

Source§

impl StructuralPartialEq for Color

Auto Trait Implementations§

§

impl Freeze for Color

§

impl RefUnwindSafe for Color

§

impl Send for Color

§

impl Sync for Color

§

impl Unpin for Color

§

impl UnwindSafe for Color

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,