pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
}Expand description
A 24-bit color value stored as R, G, and B bytes
Fields§
§r: u8Red component
g: u8Green component
b: u8Blue component
Implementations§
Source§impl Color
impl Color
Sourcepub fn html(&self) -> String
👎Deprecated since 0.7.0: Use color.to_string() instead
pub fn html(&self) -> String
Returns the html string for this color.
use mendeleev::{Element, Color};
let color = Color{r: 0, g: 255, b: 255};
assert_eq!(color.html(), "#00ffff");
let color = Color{r: 48, g: 64, b: 80};
assert_eq!(color.html(), "#304050");Trait Implementations§
Source§impl Display for Color
Displays the color as an HTML string.
impl Display for Color
Displays the color as an HTML string.
use mendeleev::{Element, Color};
let color = Color{r: 0, g: 255, b: 255};
assert_eq!(format!("{}", color), "#00ffff");
let color = Color{r: 48, g: 64, b: 80};
assert_eq!(format!("{}", color), "#304050");Source§impl Ord for Color
impl Ord for Color
Source§impl PartialOrd for Color
impl PartialOrd for Color
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