pub struct Color {
pub red: u16,
pub green: u16,
pub blue: u16,
pub alpha: u16,
}
Expand description
An RGB color with 16 bits per channel and an optional alpha channel.
Fields§
§red: u16
Red
green: u16
Green
blue: u16
Blue
alpha: u16
Alpha.
Can almost always be ignored as it is rarely set to
something other than the default (0xffff
).
Implementations§
Source§impl Color
impl Color
Sourcepub const fn rgb(red: u16, green: u16, blue: u16) -> Self
pub const fn rgb(red: u16, green: u16, blue: u16) -> Self
Construct a new Color
from (r, g, b) components, with the default alpha (0xffff
).
Sourcepub fn parse(input: &[u8]) -> Result<Color, ColorParseError>
pub fn parse(input: &[u8]) -> Result<Color, ColorParseError>
Parses the subset of X11 Color Strings
emitted by terminals in response to OSC
color queries (OSC 10
, OSC 11
, …).
This function is a rough analogue to XParseColor
.
§Accepted Formats
#<red><green><blue>
rgb:<red>/<green>/<blue>
rgba:<red>/<green>/<blue>/<alpha>
(rxvt-unicode extension)
where <red>
, <green>
and <blue>
are hexadecimal numbers with 1-4 digits.
Trait Implementations§
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