Struct termwiz::color::SrgbaTuple
source · [−]Expand description
A pixel value encoded as SRGBA RGBA values in f32 format (range: 0.0-1.0)
Tuple Fields
0: f32
1: f32
2: f32
3: f32
Implementations
sourceimpl SrgbaTuple
impl SrgbaTuple
sourcepub fn from_named(name: &str) -> Option<SrgbaTuple>
pub fn from_named(name: &str) -> Option<SrgbaTuple>
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
sourcepub fn mul_alpha(self, alpha: f32) -> SrgbaTuple
pub fn mul_alpha(self, alpha: f32) -> SrgbaTuple
Returns self multiplied by the supplied alpha value. We don’t need to linearize for this, as alpha is defined as being linear even in srgba!
pub fn to_linear(self) -> LinearRgba
pub fn to_srgb_u8(self) -> (u8, u8, u8, u8)
pub fn to_string(self) -> String
sourcepub fn to_rgb_string(self) -> String
pub fn to_rgb_string(self) -> String
Returns a string of the form #RRGGBB
pub fn to_rgba_string(self) -> String
sourcepub fn to_x11_16bit_rgb_string(self) -> String
pub fn to_x11_16bit_rgb_string(self) -> String
Returns a string of the form rgb:RRRR/GGGG/BBBB
pub fn to_laba(self) -> (f64, f64, f64, f64)
pub fn to_hsla(self) -> (f64, f64, f64, f64)
pub fn from_hsla(h: f64, s: f64, l: f64, a: f64) -> SrgbaTuple
sourcepub fn saturate(&self, factor: f64) -> SrgbaTuple
pub fn saturate(&self, factor: f64) -> SrgbaTuple
Scale the color towards the maximum saturation by factor, a value ranging from 0.0 to 1.0.
sourcepub fn saturate_fixed(&self, amount: f64) -> SrgbaTuple
pub fn saturate_fixed(&self, amount: f64) -> SrgbaTuple
Increase the saturation by amount, a value ranging from 0.0 to 1.0.
sourcepub fn lighten(&self, factor: f64) -> SrgbaTuple
pub fn lighten(&self, factor: f64) -> SrgbaTuple
Scale the color towards the maximum lightness by factor, a value ranging from 0.0 to 1.0
sourcepub fn lighten_fixed(&self, amount: f64) -> SrgbaTuple
pub fn lighten_fixed(&self, amount: f64) -> SrgbaTuple
Lighten the color by amount, a value ranging from 0.0 to 1.0
sourcepub fn adjust_hue_fixed(&self, amount: f64) -> SrgbaTuple
pub fn adjust_hue_fixed(&self, amount: f64) -> SrgbaTuple
Rotate the hue angle by the specified number of degrees
pub fn complement(&self) -> SrgbaTuple
pub fn complement_ryb(&self) -> SrgbaTuple
pub fn triad(&self) -> (SrgbaTuple, SrgbaTuple)
pub fn square(&self) -> (SrgbaTuple, SrgbaTuple, SrgbaTuple)
sourcepub fn adjust_hue_fixed_ryb(&self, amount: f64) -> SrgbaTuple
pub fn adjust_hue_fixed_ryb(&self, amount: f64) -> SrgbaTuple
Rotate the hue angle by the specified number of degrees, using the RYB color wheel
pub fn delta_e(&self, other: &SrgbaTuple) -> f32
pub fn contrast_ratio(&self, other: &SrgbaTuple) -> f64
Trait Implementations
sourceimpl Clone for SrgbaTuple
impl Clone for SrgbaTuple
sourcefn clone(&self) -> SrgbaTuple
fn clone(&self) -> SrgbaTuple
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SrgbaTuple
impl Debug for SrgbaTuple
sourceimpl Default for SrgbaTuple
impl Default for SrgbaTuple
sourcefn default() -> SrgbaTuple
fn default() -> SrgbaTuple
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for SrgbaTuple
impl<'de> Deserialize<'de> for SrgbaTuple
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<SrgbaTuple, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<SrgbaTuple, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Color> for SrgbaTuple
impl From<Color> for SrgbaTuple
sourcefn from(color: Color) -> SrgbaTuple
fn from(color: Color) -> SrgbaTuple
Converts to this type from the input type.
sourceimpl From<SrgbaTuple> for ColorSpec
impl From<SrgbaTuple> for ColorSpec
sourcefn from(col: SrgbaTuple) -> Self
fn from(col: SrgbaTuple) -> Self
Converts to this type from the input type.
sourceimpl From<SrgbaTuple> for RgbColor
impl From<SrgbaTuple> for RgbColor
sourcefn from(srgb: SrgbaTuple) -> RgbColor
fn from(srgb: SrgbaTuple) -> RgbColor
Converts to this type from the input type.
sourceimpl FromDynamic for SrgbaTuple
impl FromDynamic for SrgbaTuple
fn from_dynamic(
value: &Value,
options: FromDynamicOptions
) -> Result<SrgbaTuple, Error>
sourceimpl FromStr for SrgbaTuple
impl FromStr for SrgbaTuple
sourceimpl Hash for SrgbaTuple
impl Hash for SrgbaTuple
sourceimpl Into<SrgbaTuple> for RgbColor
impl Into<SrgbaTuple> for RgbColor
sourcefn into(self) -> SrgbaTuple
fn into(self) -> SrgbaTuple
Converts this type into the (usually inferred) input type.
sourceimpl PartialEq<SrgbaTuple> for SrgbaTuple
impl PartialEq<SrgbaTuple> for SrgbaTuple
sourcefn eq(&self, other: &SrgbaTuple) -> bool
fn eq(&self, other: &SrgbaTuple) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SrgbaTuple) -> bool
fn ne(&self, other: &SrgbaTuple) -> bool
This method tests for !=
.
sourceimpl Serialize for SrgbaTuple
impl Serialize for SrgbaTuple
sourcefn 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
sourceimpl ToDynamic for SrgbaTuple
impl ToDynamic for SrgbaTuple
fn to_dynamic(&self) -> Value
impl Copy for SrgbaTuple
impl Eq for SrgbaTuple
impl StructuralPartialEq for SrgbaTuple
Auto Trait Implementations
impl RefUnwindSafe for SrgbaTuple
impl Send for SrgbaTuple
impl Sync for SrgbaTuple
impl Unpin for SrgbaTuple
impl UnwindSafe for SrgbaTuple
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more