pub struct Color {
pub red: u8,
pub green: u8,
pub blue: u8,
}
Expand description
A structure representing a color (RGB).
Fields§
§red: u8
Red part of the color.
green: u8
Green part of the color.
blue: u8
Blue part of the color.
Implementations§
source§impl Color
impl Color
sourcepub fn from_hex_string(hex: &str) -> Result<Color, ColorError>
pub fn from_hex_string(hex: &str) -> Result<Color, ColorError>
sourcepub fn to_hex_string(&self) -> String
pub fn to_hex_string(&self) -> String
Gets the hex string representation of the supplied color.
Examples
use kpdb::Color;
let color = Color { red: 171, green: 205, blue: 239 };
let hex = color.to_hex_string();
Trait Implementations§
source§impl Ord for Color
impl Ord for Color
source§impl PartialEq<Color> for Color
impl PartialEq<Color> for Color
source§impl PartialOrd<Color> for Color
impl PartialOrd<Color> for Color
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Color
impl StructuralEq for Color
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> 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