[−][src]Struct termwiz::color::RgbColor
Describes a color in the SRGB colorspace using red, green and blue components in the range 0-255.
Fields
red: u8green: u8blue: u8Implementations
impl RgbColor[src]
pub fn new(red: u8, green: u8, blue: u8) -> Self[src]
Construct a color from discrete red, green, blue values in the range 0-255.
pub fn to_tuple_rgba(self) -> RgbaTuple[src]
pub fn to_linear_tuple_rgba(self) -> RgbaTuple[src]
pub fn from_named(name: &str) -> Option<RgbColor>[src]
Construct a color from an X11/SVG/CSS3 color name. Returns None if the supplied name is not recognized. The list of names can be found here: https://en.wikipedia.org/wiki/X11_color_names
pub fn to_rgb_string(self) -> String[src]
Returns a string of the form #RRGGBB
pub fn to_x11_16bit_rgb_string(self) -> String[src]
Returns a string of the form rgb:RRRR/GGGG/BBBB
pub fn from_rgb_str(s: &str) -> Option<RgbColor>[src]
Construct a color from a string of the form #RRGGBB where
R, G and B are all hex digits.
pub fn from_named_or_rgb_string(s: &str) -> Option<Self>[src]
Construct a color from an SVG/CSS3 color name.
or from a string of the form #RRGGBB where
R, G and B are all hex digits.
Returns None if the supplied name is not recognized.
The list of names can be found here:
https://ogeon.github.io/docs/palette/master/palette/named/index.html
Trait Implementations
impl Clone for RgbColor[src]
impl Copy for RgbColor[src]
impl Debug for RgbColor[src]
impl Default for RgbColor[src]
impl<'de> Deserialize<'de> for RgbColor[src]
pub fn deserialize<D>(deserializer: D) -> Result<RgbColor, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
impl Eq for RgbColor[src]
impl From<RgbColor> for ColorSpec[src]
impl Hash for RgbColor[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<RgbColor> for RgbColor[src]
impl Serialize for RgbColor[src]
This is mildly unfortunate: in order to round trip RgbColor with serde we need to provide a Serialize impl equivalent to the Deserialize impl below. We use the impl below to allow more flexible specification of color strings in the config file. A side effect of doing it this way is that we have to serialize RgbColor as a 7-byte string when we could otherwise serialize it as a 3-byte array. There's probably a way to make this work more efficiently, but for now this will do.
impl StructuralEq for RgbColor[src]
impl StructuralPartialEq for RgbColor[src]
Auto Trait Implementations
impl RefUnwindSafe for RgbColor[src]
impl Send for RgbColor[src]
impl Sync for RgbColor[src]
impl Unpin for RgbColor[src]
impl UnwindSafe for RgbColor[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,