Struct kludgine::Color

source ·
#[repr(C)]
pub struct Color(/* private fields */);
Expand description

A red, green, blue, and alpha color value stored in 32-bits.

Implementations§

source§

impl Color

source

pub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self

Returns a new color with the provided components.

source

pub fn new_f32(red: f32, green: f32, blue: f32, alpha: f32) -> Self

Returns a new color by converting each component from its 0.0..=1.0 range into a 0..=255 range.

source

pub const fn red(self) -> u8

Returns the red component of this color, range 0-255.

source

pub fn red_f32(self) -> f32

Returns the red component of this color, range 0.0-1.0.

source

pub const fn green(self) -> u8

Returns the green component of this color, range 0-255.

source

pub fn green_f32(self) -> f32

Returns the green component of this color, range 0.0-1.0.

source

pub const fn blue(self) -> u8

Returns the blue component of this color, range 0-255.

source

pub fn blue_f32(self) -> f32

Returns the blue component of this color, range 0.0-1.0.

source

pub const fn alpha(self) -> u8

Returns the alpha component of this color, range 0-255. A value of 255 is completely opaque.

source

pub fn alpha_f32(self) -> f32

Returns the alpha component of this color, range 0.0-1.0. A value of 1.0 is completely opaque.

source

pub const fn with_red(self, red: u8) -> Self

Returns a new color replacing this colors red channel with red.

source

pub const fn with_green(self, red: u8) -> Self

Returns a new color replacing this colors green channel with green.

source

pub const fn with_blue(self, blue: u8) -> Self

Returns a new color replacing this colors blue channel with blue.

source

pub const fn with_alpha(self, alpha: u8) -> Self

Returns a new color replacing this colors alpha channel with alpha.

source

pub fn with_red_f32(self, red: f32) -> Self

Returns a new color replacing this colors red channel with red.

source

pub fn with_green_f32(self, green: f32) -> Self

Returns a new color replacing this colors green channel with green.

source

pub fn with_blue_f32(self, blue: f32) -> Self

Returns a new color replacing this colors blue channel with blue.

source

pub fn with_alpha_f32(self, alpha: f32) -> Self

Returns a new color replacing this colors alpha channel with alpha.

source§

impl Color

source

pub const ALICEBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ANTIQUEWHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const AQUA: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const AQUAMARINE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const AZURE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BEIGE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BISQUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BLACK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BLANCHEDALMOND: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BLUEVIOLET: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BROWN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const BURLYWOOD: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CADETBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CHARTREUSE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CHOCOLATE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CLEAR_BLACK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CLEAR_WHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CORAL: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CORNFLOWERBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CORNSILK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CRIMSON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const CYAN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKCYAN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKGOLDENROD: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKKHAKI: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKMAGENTA: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKOLIVEGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKORANGE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKORCHID: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKRED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKSALMON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKSEAGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKSLATEBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKSLATEGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKSLATEGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKTURQUOISE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DARKVIOLET: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DEEPPINK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DEEPSKYBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DIMGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DIMGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const DODGERBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const FIREBRICK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const FLORALWHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const FORESTGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const FUCHSIA: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GAINSBORO: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GHOSTWHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GOLD: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GOLDENROD: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GREENYELLOW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const GREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const HONEYDEW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const HOTPINK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const INDIANRED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const INDIGO: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const IVORY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const KHAKI: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LAVENDER: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LAVENDERBLUSH: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LAWNGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LEMONCHIFFON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTCORAL: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTCYAN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTGOLDENRODYELLOW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTPINK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSALMON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSEAGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSKYBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSLATEGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSLATEGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTSTEELBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIGHTYELLOW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIME: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LIMEGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const LINEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MAGENTA: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MAROON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMAQUAMARINE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMORCHID: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMPURPLE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMSEAGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMSLATEBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMSPRINGGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMTURQUOISE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MEDIUMVIOLETRED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MIDNIGHTBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MINTCREAM: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MISTYROSE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const MOCCASIN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const NAVAJOWHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const NAVY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const OLDLACE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const OLIVE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const OLIVEDRAB: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ORANGE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ORANGERED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ORCHID: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PALEGOLDENROD: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PALEGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PALETURQUOISE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PALEVIOLETRED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PAPAYAWHIP: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PEACHPUFF: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PERU: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PINK: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PLUM: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const POWDERBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const PURPLE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const REBECCAPURPLE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const RED: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ROSYBROWN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const ROYALBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SADDLEBROWN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SALMON: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SANDYBROWN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SEAGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SEASHELL: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SIENNA: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SILVER: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SKYBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SLATEBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SLATEGRAY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SLATEGREY: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SNOW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const SPRINGGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const STEELBLUE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const TAN: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const TEAL: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const THISTLE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const TOMATO: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const TURQUOISE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const VIOLET: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const WHEAT: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const WHITE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const WHITESMOKE: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const YELLOW: Self = _

Equivalent to the CSS color keywords of the same name.

source

pub const YELLOWGREEN: Self = _

Equivalent to the CSS color keywords of the same name.

Trait Implementations§

source§

impl Clone for Color

source§

fn clone(&self) -> Color

Returns a copy 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 From<Color> for Color

source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl From<Color> for Color

source§

fn from(value: Color) -> Self

Converts to this type from the input type.
source§

impl From<Color> for Color

source§

fn from(value: Color) -> Self

Converts to this type from the input type.
source§

impl<Unit> From<Color> for StrokeOptions<Unit>
where Unit: DefaultStrokeWidth,

source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl Hash for Color

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Color

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Zeroable for Color

source§

fn zeroed() -> Self

source§

impl Copy for Color

source§

impl Eq for Color

source§

impl Pod for Color

source§

impl StructuralEq for Color

source§

impl StructuralPartialEq for Color

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§

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<A> Cast for A

source§

fn cast<To>(self) -> To
where To: CastFrom<A>,

Casts self to the To type. This may be a lossy operation.
source§

impl<A> CastFrom<A> for A

source§

fn from_cast(from: A) -> A

Returns from as Self.
source§

impl<A, B> CastInto<A> for B
where A: CastFrom<B>,

source§

fn cast_into(self) -> A

Returns self as To.
source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<Unit> IntoComponents<Unit> for Unit
where Unit: Copy,

source§

fn into_components(self) -> (Unit, Unit)

Extracts this type’s 2d vector components.
source§

fn to_vec<Type>(self) -> Type
where Type: FromComponents<Unit>,

Converts this type to another type using FromComponents and IntoComponents.
source§

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

§

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>,

§

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>,

§

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> AnyBitPattern for T
where T: Pod,

source§

impl<T> NoUninit for T
where T: Pod,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSync for T
where T: Sync,