pub struct Color(/* private fields */);Expand description
Represents one color. You may create Colors using
- Color::from_rgb,
- Color::from_argb,
- Color::from_af32rgb,
- Color::new,
- Or using tuples like
(255, 0, 150),(133, 133, 133, 0.5)(alpha asf32in 0.0..=1.0), or(200, 100, 50, 180)(alpha asu8in 0..=255)
Implementations§
Source§impl Color
impl Color
pub const TRANSPARENT: Color
pub const BLACK: Color
pub const DARK_GRAY: Color
pub const GRAY: Color
pub const LIGHT_GRAY: Color
pub const DARK_GREY: Color
pub const GREY: Color
pub const LIGHT_GREY: Color
pub const WHITE: Color
pub const RED: Color
pub const GREEN: Color
pub const BLUE: Color
pub const YELLOW: Color
pub const CYAN: Color
pub const MAGENTA: Color
pub const fn new(value: u32) -> Color
pub const fn from_af32rgb(a: f32, r: u8, g: u8, b: u8) -> Color
pub const fn from_argb(a: u8, r: u8, g: u8, b: u8) -> Color
pub const fn from_rgb(r: u8, g: u8, b: u8) -> Color
pub fn from_hsv(h: f32, s: f32, v: f32) -> Color
pub fn from_hex(hex: &str) -> Option<Color>
pub fn with_a(self, a: u8) -> Color
pub fn a(self) -> u8
pub fn r(self) -> u8
pub fn g(self) -> u8
pub fn b(self) -> u8
pub fn to_rgb(self) -> RGB
pub fn to_hsv(self) -> HSV
pub fn with_h(self, h: f32) -> Color
pub fn with_s(self, s: f32) -> Color
pub fn with_v(self, v: f32) -> Color
pub fn to_hex_string(&self) -> String
pub fn to_rgb_string(&self) -> String
pub fn pretty(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Color, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Color, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Color
impl Serialize for Color
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Color
impl Eq for Color
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ComponentProps for T
impl<T> ComponentProps for T
fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().