Struct Color

Source
pub struct Color {
    pub r: u8,
    pub g: u8,
    pub b: u8,
}
Expand description

RGB Color struct.

Fields:

Color.r
Color.g
Color.b

Fields§

§r: u8§g: u8§b: u8

Implementations§

Source§

impl Color

Source

pub const ALICE_BLUE: Color

Source

pub const ANTIQUE_WHITE: Color

Source

pub const AQUA: Color

Source

pub const AQUAMARINE: Color

Source

pub const AZURE: Color

Source

pub const BEIGE: Color

Source

pub const BISQUE: Color

Source

pub const BLACK: Color

Source

pub const BLANCHED_ALMOND: Color

Source

pub const BLUE: Color

Source

pub const BLUE_VIOLET: Color

Source

pub const BROWN: Color

Source

pub const BURLYWOOD: Color

Source

pub const CADET_BLUE: Color

Source

pub const CHARTREUSE: Color

Source

pub const CHOCOLATE: Color

Source

pub const CORAL: Color

Source

pub const CORNFLOWER_BLUE: Color

Source

pub const CORNSILK: Color

Source

pub const CRIMSON: Color

Source

pub const CYAN: Color

Source

pub const DARK_BLUE: Color

Source

pub const DARK_CYAN: Color

Source

pub const DARK_GOLDENROD: Color

Source

pub const DARK_GRAY: Color

Source

pub const DARK_GREEN: Color

Source

pub const DARK_KHAKI: Color

Source

pub const DARK_MAGENTA: Color

Source

pub const DARK_OLIVE_GREEN: Color

Source

pub const DARK_ORANGE: Color

Source

pub const DARK_ORCHID: Color

Source

pub const DARK_RED: Color

Source

pub const DARK_SALMON: Color

Source

pub const DARK_SEA_GREEN: Color

Source

pub const DARK_SLATE_BLUE: Color

Source

pub const DARK_SLATE_GRAY: Color

Source

pub const DARK_TURQUOISE: Color

Source

pub const DARK_VIOLET: Color

Source

pub const DEEP_PINK: Color

Source

pub const DEEP_SKY_BLUE: Color

Source

pub const DIM_GRAY: Color

Source

pub const DODGER_BLUE: Color

Source

pub const FIREBRICK: Color

Source

pub const FLORAL_WHITE: Color

Source

pub const FOREST_GREEN: Color

Source

pub const FUCHSIA: Color

Source

pub const GAINSBORO: Color

Source

pub const GHOST_WHITE: Color

Source

pub const GOLD: Color

Source

pub const GOLDENROD: Color

Source

pub const GRAY: Color

Source

pub const GREEN: Color

Source

pub const GREEN_YELLOW: Color

Source

pub const HONEYDEW: Color

Source

pub const HOT_PINK: Color

Source

pub const INDIAN_RED: Color

Source

pub const INDIGO: Color

Source

pub const IVORY: Color

Source

pub const KHAKI: Color

Source

pub const LAVENDER: Color

Source

pub const LAVENDER_BLUSH: Color

Source

pub const LAWN_GREEN: Color

Source

pub const LEMON_CHIFFON: Color

Source

pub const LIGHT_BLUE: Color

Source

pub const LIGHT_CORAL: Color

Source

pub const LIGHT_CYAN: Color

Source

pub const LIGHT_GOLDENROD: Color

Source

pub const LIGHT_GRAY: Color

Source

pub const LIGHT_GREEN: Color

Source

pub const LIGHT_PINK: Color

Source

pub const LIGHT_SALMON: Color

Source

pub const LIGHT_SEA_GREEN: Color

Source

pub const LIGHT_SKY_BLUE: Color

Source

pub const LIGHT_SLATE_GRAY: Color

Source

pub const LIGHT_STEEL_BLUE: Color

Source

pub const LIGHT_YELLOW: Color

Source

pub const LIME: Color

Source

pub const LIME_GREEN: Color

Source

pub const LINEN: Color

Source

pub const MAGENTA: Color

Source

pub const MAROON: Color

Source

pub const MEDIUM_AQUAMARINE: Color

Source

pub const MEDIUM_BLUE: Color

Source

pub const MEDIUM_ORCHID: Color

Source

pub const MEDIUM_PURPLE: Color

Source

pub const MEDIUM_SEA_GREEN: Color

Source

pub const MEDIUM_SLATE_BLUE: Color

Source

pub const MEDIUM_SPRING_GREEN: Color

Source

pub const MEDIUM_TURQUOISE: Color

Source

pub const MEDIUM_VIOLET_RED: Color

Source

pub const MIDNIGHT_BLUE: Color

Source

pub const MINT_CREAM: Color

Source

pub const MISTY_ROSE: Color

Source

pub const MOCCASIN: Color

Source

pub const NAVAJO_WHITE: Color

Source

pub const NAVY_BLUE: Color

Source

pub const OLD_LACE: Color

Source

pub const OLIVE: Color

Source

pub const OLIVE_DRAB: Color

Source

pub const ORANGE: Color

Source

pub const ORANGE_RED: Color

Source

pub const ORCHID: Color

Source

pub const PALE_GOLDENROD: Color

Source

pub const PALE_GREEN: Color

Source

pub const PALE_TURQUOISE: Color

Source

pub const PALE_VIOLET_RED: Color

Source

pub const PAPAYA_WHIP: Color

Source

pub const PEACH_PUFF: Color

Source

pub const PERU: Color

Source

pub const PINK: Color

Source

pub const PLUM: Color

Source

pub const POWDER_BLUE: Color

Source

pub const PURPLE: Color

Source

pub const REBECCA_PURPLE: Color

Source

pub const RED: Color

Source

pub const ROSY_BROWN: Color

Source

pub const ROYAL_BLUE: Color

Source

pub const SADDLE_BROWN: Color

Source

pub const SALMON: Color

Source

pub const SANDY_BROWN: Color

Source

pub const SEA_GREEN: Color

Source

pub const SEASHELL: Color

Source

pub const SIENNA: Color

Source

pub const SILVER: Color

Source

pub const SKY_BLUE: Color

Source

pub const SLATE_BLUE: Color

Source

pub const SLATE_GRAY: Color

Source

pub const SNOW: Color

Source

pub const SPRING_GREEN: Color

Source

pub const STEEL_BLUE: Color

Source

pub const TAN: Color

Source

pub const TEAL: Color

Source

pub const THISTLE: Color

Source

pub const TOMATO: Color

Source

pub const TRANSPARENT: Color

Source

pub const TURQUOISE: Color

Source

pub const VIOLET: Color

Source

pub const WEB_GRAY: Color

Source

pub const WEB_GREEN: Color

Source

pub const WEB_MAROON: Color

Source

pub const WEB_PURPLE: Color

Source

pub const WHEAT: Color

Source

pub const WHITE: Color

Source

pub const WHITE_SMOKE: Color

Source

pub const YELLOW: Color

Source

pub const YELLOW_GREEN: Color

Source

pub const fn rgb(r: u8, g: u8, b: u8) -> Self

Creates a color.

Source

pub const fn hex(h: u32) -> Self

Creates a color.

Source

pub fn raw_rgb(r: f32, g: f32, b: f32) -> Self

Source

pub fn raw_vec3_rgb(c: Vec3f) -> Self

Source

pub fn okhsl(h: f32, s: f32, l: f32) -> Self

Source

pub fn get_raw(&self) -> (f32, f32, f32)

Source

pub fn get_raw_vec3f(&self) -> Vec3f

Source

pub fn get_okhsl(&self) -> (f32, f32, f32)

Source

pub fn blend(a: Color, b: Color, mode: BlendMode) -> Self

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 Display for Color

Source§

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

Writes the CSI to set background or color (respectively when using {:-} or {:+}) to f.

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 Copy for Color

Source§

impl Eq 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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
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, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
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, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

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

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

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

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. 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, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

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
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.