Color

Struct Color 

Source
#[repr(C, align(4))]
pub struct Color { pub blue: u8, pub green: u8, pub red: u8, /* private fields */ }
Expand description

RGB 颜色类型

Fields§

§blue: u8§green: u8§red: u8

Implementations§

Source§

impl Color

Source

pub const BLACK: Color

Source

pub const SILVER: Color

Source

pub const GRAY: Color

Source

pub const WHITE: Color

Source

pub const MAROON: Color

Source

pub const RED: Color

Source

pub const PURPLE: Color

Source

pub const FUCHSIA: Color

Source

pub const GREEN: Color

Source

pub const LIME: Color

Source

pub const OLIVE: Color

Source

pub const YELLOW: Color

Source

pub const NAVY: Color

Source

pub const BLUE: Color

Source

pub const TEAL: Color

Source

pub const AQUA: Color

Source

pub const ALICEBLUE: Color

Source

pub const ANTIQUEWHITE: Color

Source

pub const AQUAMARINE: Color

Source

pub const AZURE: Color

Source

pub const BEIGE: Color

Source

pub const BISQUE: Color

Source

pub const BLANCHEDALMOND: Color

Source

pub const BLUEVIOLET: Color

Source

pub const BROWN: Color

Source

pub const BURLYWOOD: Color

Source

pub const CADETBLUE: Color

Source

pub const CHARTREUSE: Color

Source

pub const CHOCOLATE: Color

Source

pub const CORAL: Color

Source

pub const CORNFLOWERBLUE: Color

Source

pub const CORNSILK: Color

Source

pub const CRIMSON: Color

Source

pub const DARKBLUE: Color

Source

pub const DARKCYAN: Color

Source

pub const DARKGOLDENROD: Color

Source

pub const DARKGRAY: Color

Source

pub const DARKGREEN: Color

Source

pub const DARKGREY: Color

Source

pub const DARKKHAKI: Color

Source

pub const DARKMAGENTA: Color

Source

pub const DARKOLIVEGREEN: Color

Source

pub const DARKORANGE: Color

Source

pub const DARKORCHID: Color

Source

pub const DARKRED: Color

Source

pub const DARKSALMON: Color

Source

pub const DARKSEAGREEN: Color

Source

pub const DARKSLATEBLUE: Color

Source

pub const DARKSLATEGRAY: Color

Source

pub const DARKSLATEGREY: Color

Source

pub const DARKTURQUOISE: Color

Source

pub const DARKVIOLET: Color

Source

pub const DEEPPINK: Color

Source

pub const DEEPSKYBLUE: Color

Source

pub const DIMGRAY: Color

Source

pub const DIMGREY: Color

Source

pub const DODGERBLUE: Color

Source

pub const FIREBRICK: Color

Source

pub const FLORALWHITE: Color

Source

pub const FORESTGREEN: Color

Source

pub const GAINSBORO: Color

Source

pub const GHOSTWHITE: Color

Source

pub const GOLD: Color

Source

pub const GOLDENROD: Color

Source

pub const GREENYELLOW: Color

Source

pub const HONEYDEW: Color

Source

pub const HOTPINK: Color

Source

pub const INDIANRED: Color

Source

pub const INDIGO: Color

Source

pub const IVORY: Color

Source

pub const KHAKI: Color

Source

pub const LAVENDER: Color

Source

pub const LAVENDERBLUSH: Color

Source

pub const LAWNGREEN: Color

Source

pub const LEMONCHIFFON: Color

Source

pub const LIGHTBLUE: Color

Source

pub const LIGHTCORAL: Color

Source

pub const LIGHTCYAN: Color

Source

pub const LIGHTGOLDENRODYELLOW: Color

Source

pub const LIGHTGRAY: Color

Source

pub const LIGHTGREEN: Color

Source

pub const LIGHTGREY: Color

Source

pub const LIGHTPINK: Color

Source

pub const LIGHTSALMON: Color

Source

pub const LIGHTSEAGREEN: Color

Source

pub const LIGHTSKYBLUE: Color

Source

pub const LIGHTSLATEGRAY: Color

Source

pub const LIGHTSLATEGREY: Color

Source

pub const LIGHTSTEELBLUE: Color

Source

pub const LIGHTYELLOW: Color

Source

pub const LIMEGREEN: Color

Source

pub const LINEN: Color

Source

pub const MEDIUMAQUAMARINE: Color

Source

pub const MEDIUMBLUE: Color

Source

pub const MEDIUMORCHID: Color

Source

pub const MEDIUMPURPLE: Color

Source

pub const MEDIUMSEAGREEN: Color

Source

pub const MEDIUMSLATEBLUE: Color

Source

pub const MEDIUMSPRINGGREEN: Color

Source

pub const MEDIUMTURQUOISE: Color

Source

pub const MEDIUMVIOLETRED: Color

Source

pub const MIDNIGHTBLUE: Color

Source

pub const MINTCREAM: Color

Source

pub const MISTYROSE: Color

Source

pub const MOCCASIN: Color

Source

pub const NAVAJOWHITE: Color

Source

pub const OLDLACE: Color

Source

pub const OLIVEDRAB: Color

Source

pub const ORANGE: Color

Source

pub const ORANGERED: Color

Source

pub const ORCHID: Color

Source

pub const PALEGOLDENROD: Color

Source

pub const PALEGREEN: Color

Source

pub const PALETURQUOISE: Color

Source

pub const PALEVIOLETRED: Color

Source

pub const PAPAYAWHIP: Color

Source

pub const PEACHPUFF: Color

Source

pub const PERU: Color

Source

pub const PINK: Color

Source

pub const PLUM: Color

Source

pub const POWDERBLUE: Color

Source

pub const REBECCAPURPLE: Color

Source

pub const ROSYBROWN: Color

Source

pub const ROYALBLUE: Color

Source

pub const SADDLEBROWN: Color

Source

pub const SALMON: Color

Source

pub const SANDYBROWN: Color

Source

pub const SEAGREEN: Color

Source

pub const SEASHELL: Color

Source

pub const SIENNA: Color

Source

pub const SKYBLUE: Color

Source

pub const SLATEBLUE: Color

Source

pub const SLATEGRAY: Color

Source

pub const SLATEGREY: Color

Source

pub const SNOW: Color

Source

pub const SPRINGGREEN: Color

Source

pub const STEELBLUE: Color

Source

pub const TAN: Color

Source

pub const THISTLE: Color

Source

pub const TOMATO: Color

Source

pub const TURQUOISE: Color

Source

pub const VIOLET: Color

Source

pub const WHEAT: Color

Source

pub const WHITESMOKE: Color

Source

pub const YELLOWGREEN: Color

Source§

impl Color

Source

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

创建一个颜色

Source§

impl Color

Source

pub const fn into_hsv(self) -> ColorHSV

将 RGB 颜色转换为 HSV 颜色

Source

pub const fn into_hsl(self) -> ColorHSL

将 RGB 颜色转换为 HSL 颜色

Source

pub const fn from_hsv(hsv: ColorHSV) -> Color

将 HSV 颜色转换为 RGB 颜色

Source

pub const fn from_hsl(hsl: ColorHSL) -> Color

将 HSL 颜色转换为 RGB 颜色

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<(), Error>

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

impl From<ColorHSL> for Color

Source§

fn from(hsl: ColorHSL) -> Color

Converts to this type from the input type.
Source§

impl From<ColorHSV> for Color

Source§

fn from(hsv: ColorHSV) -> Color

Converts to this type from the input type.
Source§

impl From<u32> for Color

Source§

fn from(color: u32) -> Color

Converts to this type from the input type.
Source§

impl Hash for Color

Source§

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

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 Into<ColorHSL> for Color

Source§

fn into(self) -> ColorHSL

Converts this type into the (usually inferred) input type.
Source§

impl Into<ColorHSV> for Color

Source§

fn into(self) -> ColorHSV

Converts this type into the (usually inferred) input type.
Source§

impl Into<u32> for Color

Source§

fn into(self) -> u32

Converts this type into the (usually inferred) input type.
Source§

impl Ord for Color

Source§

fn cmp(&self, other: &Color) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
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 PartialOrd for Color

Source§

fn partial_cmp(&self, other: &Color) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
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<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.