Skip to main content

Color

Struct Color 

Source
pub struct Color(/* private fields */);
Expand description

A color: a named color such as Color::CRIMSON, a hex or RGB value, a mix of two colors, or a Token that holds one.

Implementations§

Source§

impl Color

Source

pub const ALICEBLUE: Self

The named color aliceblue.

Source

pub const ANTIQUEWHITE: Self

The named color antiquewhite.

Source

pub const AQUA: Self

The named color aqua.

Source

pub const AQUAMARINE: Self

The named color aquamarine.

Source

pub const AZURE: Self

The named color azure.

Source

pub const BEIGE: Self

The named color beige.

Source

pub const BISQUE: Self

The named color bisque.

Source

pub const BLACK: Self

The named color black.

Source

pub const BLANCHEDALMOND: Self

The named color blanchedalmond.

Source

pub const BLUE: Self

The named color blue.

Source

pub const BLUEVIOLET: Self

The named color blueviolet.

Source

pub const BROWN: Self

The named color brown.

Source

pub const BURLYWOOD: Self

The named color burlywood.

Source

pub const CADETBLUE: Self

The named color cadetblue.

Source

pub const CHARTREUSE: Self

The named color chartreuse.

Source

pub const CHOCOLATE: Self

The named color chocolate.

Source

pub const CORAL: Self

The named color coral.

Source

pub const CORNFLOWERBLUE: Self

The named color cornflowerblue.

Source

pub const CORNSILK: Self

The named color cornsilk.

Source

pub const CRIMSON: Self

The named color crimson.

Source

pub const CYAN: Self

The named color cyan.

Source

pub const DARKBLUE: Self

The named color darkblue.

Source

pub const DARKCYAN: Self

The named color darkcyan.

Source

pub const DARKGOLDENROD: Self

The named color darkgoldenrod.

Source

pub const DARKGRAY: Self

The named color darkgray.

Source

pub const DARKGREEN: Self

The named color darkgreen.

Source

pub const DARKGREY: Self

The named color darkgrey.

Source

pub const DARKKHAKI: Self

The named color darkkhaki.

Source

pub const DARKMAGENTA: Self

The named color darkmagenta.

Source

pub const DARKOLIVEGREEN: Self

The named color darkolivegreen.

Source

pub const DARKORANGE: Self

The named color darkorange.

Source

pub const DARKORCHID: Self

The named color darkorchid.

Source

pub const DARKRED: Self

The named color darkred.

Source

pub const DARKSALMON: Self

The named color darksalmon.

Source

pub const DARKSEAGREEN: Self

The named color darkseagreen.

Source

pub const DARKSLATEBLUE: Self

The named color darkslateblue.

Source

pub const DARKSLATEGRAY: Self

The named color darkslategray.

Source

pub const DARKSLATEGREY: Self

The named color darkslategrey.

Source

pub const DARKTURQUOISE: Self

The named color darkturquoise.

Source

pub const DARKVIOLET: Self

The named color darkviolet.

Source

pub const DEEPPINK: Self

The named color deeppink.

Source

pub const DEEPSKYBLUE: Self

The named color deepskyblue.

Source

pub const DIMGRAY: Self

The named color dimgray.

Source

pub const DIMGREY: Self

The named color dimgrey.

Source

pub const DODGERBLUE: Self

The named color dodgerblue.

Source

pub const FIREBRICK: Self

The named color firebrick.

Source

pub const FLORALWHITE: Self

The named color floralwhite.

Source

pub const FORESTGREEN: Self

The named color forestgreen.

Source

pub const FUCHSIA: Self

The named color fuchsia.

Source

pub const GAINSBORO: Self

The named color gainsboro.

Source

pub const GHOSTWHITE: Self

The named color ghostwhite.

Source

pub const GOLD: Self

The named color gold.

Source

pub const GOLDENROD: Self

The named color goldenrod.

Source

pub const GRAY: Self

The named color gray.

Source

pub const GREEN: Self

The named color green.

Source

pub const GREENYELLOW: Self

The named color greenyellow.

Source

pub const GREY: Self

The named color grey.

Source

pub const HONEYDEW: Self

The named color honeydew.

Source

pub const HOTPINK: Self

The named color hotpink.

Source

pub const INDIANRED: Self

The named color indianred.

Source

pub const INDIGO: Self

The named color indigo.

Source

pub const IVORY: Self

The named color ivory.

Source

pub const KHAKI: Self

The named color khaki.

Source

pub const LAVENDER: Self

The named color lavender.

Source

pub const LAVENDERBLUSH: Self

The named color lavenderblush.

Source

pub const LAWNGREEN: Self

The named color lawngreen.

Source

pub const LEMONCHIFFON: Self

The named color lemonchiffon.

Source

pub const LIGHTBLUE: Self

The named color lightblue.

Source

pub const LIGHTCORAL: Self

The named color lightcoral.

Source

pub const LIGHTCYAN: Self

The named color lightcyan.

Source

pub const LIGHTGOLDENRODYELLOW: Self

The named color lightgoldenrodyellow.

Source

pub const LIGHTGRAY: Self

The named color lightgray.

Source

pub const LIGHTGREEN: Self

The named color lightgreen.

Source

pub const LIGHTGREY: Self

The named color lightgrey.

Source

pub const LIGHTPINK: Self

The named color lightpink.

Source

pub const LIGHTSALMON: Self

The named color lightsalmon.

Source

pub const LIGHTSEAGREEN: Self

The named color lightseagreen.

Source

pub const LIGHTSKYBLUE: Self

The named color lightskyblue.

Source

pub const LIGHTSLATEGRAY: Self

The named color lightslategray.

Source

pub const LIGHTSLATEGREY: Self

The named color lightslategrey.

Source

pub const LIGHTSTEELBLUE: Self

The named color lightsteelblue.

Source

pub const LIGHTYELLOW: Self

The named color lightyellow.

Source

pub const LIME: Self

The named color lime.

Source

pub const LIMEGREEN: Self

The named color limegreen.

Source

pub const LINEN: Self

The named color linen.

Source

pub const MAGENTA: Self

The named color magenta.

Source

pub const MAROON: Self

The named color maroon.

Source

pub const MEDIUMAQUAMARINE: Self

The named color mediumaquamarine.

Source

pub const MEDIUMBLUE: Self

The named color mediumblue.

Source

pub const MEDIUMORCHID: Self

The named color mediumorchid.

Source

pub const MEDIUMPURPLE: Self

The named color mediumpurple.

Source

pub const MEDIUMSEAGREEN: Self

The named color mediumseagreen.

Source

pub const MEDIUMSLATEBLUE: Self

The named color mediumslateblue.

Source

pub const MEDIUMSPRINGGREEN: Self

The named color mediumspringgreen.

Source

pub const MEDIUMTURQUOISE: Self

The named color mediumturquoise.

Source

pub const MEDIUMVIOLETRED: Self

The named color mediumvioletred.

Source

pub const MIDNIGHTBLUE: Self

The named color midnightblue.

Source

pub const MINTCREAM: Self

The named color mintcream.

Source

pub const MISTYROSE: Self

The named color mistyrose.

Source

pub const MOCCASIN: Self

The named color moccasin.

Source

pub const NAVAJOWHITE: Self

The named color navajowhite.

Source

pub const NAVY: Self

The named color navy.

Source

pub const OLDLACE: Self

The named color oldlace.

Source

pub const OLIVE: Self

The named color olive.

Source

pub const OLIVEDRAB: Self

The named color olivedrab.

Source

pub const ORANGE: Self

The named color orange.

Source

pub const ORANGERED: Self

The named color orangered.

Source

pub const ORCHID: Self

The named color orchid.

Source

pub const PALEGOLDENROD: Self

The named color palegoldenrod.

Source

pub const PALEGREEN: Self

The named color palegreen.

Source

pub const PALETURQUOISE: Self

The named color paleturquoise.

Source

pub const PALEVIOLETRED: Self

The named color palevioletred.

Source

pub const PAPAYAWHIP: Self

The named color papayawhip.

Source

pub const PEACHPUFF: Self

The named color peachpuff.

Source

pub const PERU: Self

The named color peru.

Source

pub const PINK: Self

The named color pink.

Source

pub const PLUM: Self

The named color plum.

Source

pub const POWDERBLUE: Self

The named color powderblue.

Source

pub const PURPLE: Self

The named color purple.

Source

pub const REBECCAPURPLE: Self

The named color rebeccapurple.

Source

pub const RED: Self

The named color red.

Source

pub const ROSYBROWN: Self

The named color rosybrown.

Source

pub const ROYALBLUE: Self

The named color royalblue.

Source

pub const SADDLEBROWN: Self

The named color saddlebrown.

Source

pub const SALMON: Self

The named color salmon.

Source

pub const SANDYBROWN: Self

The named color sandybrown.

Source

pub const SEAGREEN: Self

The named color seagreen.

Source

pub const SEASHELL: Self

The named color seashell.

Source

pub const SIENNA: Self

The named color sienna.

Source

pub const SILVER: Self

The named color silver.

Source

pub const SKYBLUE: Self

The named color skyblue.

Source

pub const SLATEBLUE: Self

The named color slateblue.

Source

pub const SLATEGRAY: Self

The named color slategray.

Source

pub const SLATEGREY: Self

The named color slategrey.

Source

pub const SNOW: Self

The named color snow.

Source

pub const SPRINGGREEN: Self

The named color springgreen.

Source

pub const STEELBLUE: Self

The named color steelblue.

Source

pub const TAN: Self

The named color tan.

Source

pub const TEAL: Self

The named color teal.

Source

pub const THISTLE: Self

The named color thistle.

Source

pub const TOMATO: Self

The named color tomato.

Source

pub const TURQUOISE: Self

The named color turquoise.

Source

pub const VIOLET: Self

The named color violet.

Source

pub const WHEAT: Self

The named color wheat.

Source

pub const WHITE: Self

The named color white.

Source

pub const WHITESMOKE: Self

The named color whitesmoke.

Source

pub const YELLOW: Self

The named color yellow.

Source

pub const YELLOWGREEN: Self

The named color yellowgreen.

Source§

impl Color

Source

pub const CURRENT_COLOR: Self

The element’s color, written currentColor.

Source

pub const TRANSPARENT: Self

Fully transparent black, written transparent. MDN lists it apart from the named colors, so the generator does not write it.

Source

pub fn hex(rgb: u32) -> Self

The color #rrggbb from the low 24 bits of rgb, as in Color::hex(0xb83f45).

Source

pub fn rgb(red: u8, green: u8, blue: u8) -> Self

The color with red, green, and blue channels from 0 to 255.

Source

pub fn opacity(&self, opacity: u8) -> Self

This color at opacity percent, mixed with transparent in sRGB.

Source

pub fn mix(&self, other: &Self, weight: u8) -> Self

weight percent of this color mixed with the rest of other, in sRGB.

Trait Implementations§

Source§

impl Clone for Color

Source§

fn clone(&self) -> Color

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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

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

impl Eq for Color

Source§

impl From<Color> for AccentColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for Border

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderBlock

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderBlockColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderBlockEnd

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderBlockStart

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderBottom

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderInline

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderInlineColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderInlineEnd

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderInlineStart

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderLeft

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderRight

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for BorderTop

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for Caret

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for CaretColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for ColumnRule

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for Fill

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for Outline

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for OutlineColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for ScrollbarColor

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for Stroke

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for TextDecoration

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl From<Color> for TextEmphasis

Source§

fn from(v: Color) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Color

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Color

Source§

impl TokenValue 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 UnsafeUnpin 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> 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, 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.