Skip to main content

Color

Struct Color 

Source
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: Self

Source

pub const SILVER: Self

Source

pub const GRAY: Self

Source

pub const WHITE: Self

Source

pub const MAROON: Self

Source

pub const RED: Self

Source

pub const PURPLE: Self

Source

pub const FUCHSIA: Self

Source

pub const GREEN: Self

Source

pub const LIME: Self

Source

pub const OLIVE: Self

Source

pub const YELLOW: Self

Source

pub const NAVY: Self

Source

pub const BLUE: Self

Source

pub const TEAL: Self

Source

pub const AQUA: Self

Source

pub const ALICEBLUE: Self

Source

pub const ANTIQUEWHITE: Self

Source

pub const AQUAMARINE: Self

Source

pub const AZURE: Self

Source

pub const BEIGE: Self

Source

pub const BISQUE: Self

Source

pub const BLANCHEDALMOND: Self

Source

pub const BLUEVIOLET: Self

Source

pub const BROWN: Self

Source

pub const BURLYWOOD: Self

Source

pub const CADETBLUE: Self

Source

pub const CHARTREUSE: Self

Source

pub const CHOCOLATE: Self

Source

pub const CORAL: Self

Source

pub const CORNFLOWERBLUE: Self

Source

pub const CORNSILK: Self

Source

pub const CRIMSON: Self

Source

pub const DARKBLUE: Self

Source

pub const DARKCYAN: Self

Source

pub const DARKGOLDENROD: Self

Source

pub const DARKGRAY: Self

Source

pub const DARKGREEN: Self

Source

pub const DARKGREY: Self

Source

pub const DARKKHAKI: Self

Source

pub const DARKMAGENTA: Self

Source

pub const DARKOLIVEGREEN: Self

Source

pub const DARKORANGE: Self

Source

pub const DARKORCHID: Self

Source

pub const DARKRED: Self

Source

pub const DARKSALMON: Self

Source

pub const DARKSEAGREEN: Self

Source

pub const DARKSLATEBLUE: Self

Source

pub const DARKSLATEGRAY: Self

Source

pub const DARKSLATEGREY: Self

Source

pub const DARKTURQUOISE: Self

Source

pub const DARKVIOLET: Self

Source

pub const DEEPPINK: Self

Source

pub const DEEPSKYBLUE: Self

Source

pub const DIMGRAY: Self

Source

pub const DIMGREY: Self

Source

pub const DODGERBLUE: Self

Source

pub const FIREBRICK: Self

Source

pub const FLORALWHITE: Self

Source

pub const FORESTGREEN: Self

Source

pub const GAINSBORO: Self

Source

pub const GHOSTWHITE: Self

Source

pub const GOLD: Self

Source

pub const GOLDENROD: Self

Source

pub const GREENYELLOW: Self

Source

pub const HONEYDEW: Self

Source

pub const HOTPINK: Self

Source

pub const INDIANRED: Self

Source

pub const INDIGO: Self

Source

pub const IVORY: Self

Source

pub const KHAKI: Self

Source

pub const LAVENDER: Self

Source

pub const LAVENDERBLUSH: Self

Source

pub const LAWNGREEN: Self

Source

pub const LEMONCHIFFON: Self

Source

pub const LIGHTBLUE: Self

Source

pub const LIGHTCORAL: Self

Source

pub const LIGHTCYAN: Self

Source

pub const LIGHTGOLDENRODYELLOW: Self

Source

pub const LIGHTGRAY: Self

Source

pub const LIGHTGREEN: Self

Source

pub const LIGHTGREY: Self

Source

pub const LIGHTPINK: Self

Source

pub const LIGHTSALMON: Self

Source

pub const LIGHTSEAGREEN: Self

Source

pub const LIGHTSKYBLUE: Self

Source

pub const LIGHTSLATEGRAY: Self

Source

pub const LIGHTSLATEGREY: Self

Source

pub const LIGHTSTEELBLUE: Self

Source

pub const LIGHTYELLOW: Self

Source

pub const LIMEGREEN: Self

Source

pub const LINEN: Self

Source

pub const MEDIUMAQUAMARINE: Self

Source

pub const MEDIUMBLUE: Self

Source

pub const MEDIUMORCHID: Self

Source

pub const MEDIUMPURPLE: Self

Source

pub const MEDIUMSEAGREEN: Self

Source

pub const MEDIUMSLATEBLUE: Self

Source

pub const MEDIUMSPRINGGREEN: Self

Source

pub const MEDIUMTURQUOISE: Self

Source

pub const MEDIUMVIOLETRED: Self

Source

pub const MIDNIGHTBLUE: Self

Source

pub const MINTCREAM: Self

Source

pub const MISTYROSE: Self

Source

pub const MOCCASIN: Self

Source

pub const NAVAJOWHITE: Self

Source

pub const OLDLACE: Self

Source

pub const OLIVEDRAB: Self

Source

pub const ORANGE: Self

Source

pub const ORANGERED: Self

Source

pub const ORCHID: Self

Source

pub const PALEGOLDENROD: Self

Source

pub const PALEGREEN: Self

Source

pub const PALETURQUOISE: Self

Source

pub const PALEVIOLETRED: Self

Source

pub const PAPAYAWHIP: Self

Source

pub const PEACHPUFF: Self

Source

pub const PERU: Self

Source

pub const PINK: Self

Source

pub const PLUM: Self

Source

pub const POWDERBLUE: Self

Source

pub const REBECCAPURPLE: Self

Source

pub const ROSYBROWN: Self

Source

pub const ROYALBLUE: Self

Source

pub const SADDLEBROWN: Self

Source

pub const SALMON: Self

Source

pub const SANDYBROWN: Self

Source

pub const SEAGREEN: Self

Source

pub const SEASHELL: Self

Source

pub const SIENNA: Self

Source

pub const SKYBLUE: Self

Source

pub const SLATEBLUE: Self

Source

pub const SLATEGRAY: Self

Source

pub const SLATEGREY: Self

Source

pub const SNOW: Self

Source

pub const SPRINGGREEN: Self

Source

pub const STEELBLUE: Self

Source

pub const TAN: Self

Source

pub const THISTLE: Self

Source

pub const TOMATO: Self

Source

pub const TURQUOISE: Self

Source

pub const VIOLET: Self

Source

pub const WHEAT: Self

Source

pub const WHITESMOKE: Self

Source

pub const YELLOWGREEN: Self

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 (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 From<ColorHSL> for Color

Source§

fn from(hsl: ColorHSL) -> Self

Converts to this type from the input type.
Source§

impl From<ColorHSV> for Color

Source§

fn from(hsv: ColorHSV) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Color

Source§

fn from(color: u32) -> 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 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 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 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, 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.