pub struct Hct { /* private fields */ }Implementations§
Source§impl Hct
impl Hct
Sourcepub const fn get_hue(&self) -> f64
pub const fn get_hue(&self) -> f64
A number, in degrees, representing ex. red, orange, yellow, etc.
Ranges from 0 <= hue < 360
0 <= new_hue < 360; invalid values are corrected.
After setting hue, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
Sourcepub fn set_hue(&mut self, value: f64)
pub fn set_hue(&mut self, value: f64)
A number, in degrees, representing ex. red, orange, yellow, etc.
Ranges from 0 <= hue < 360
0 <= new_hue < 360; invalid values are corrected.
After setting hue, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
Sourcepub const fn get_chroma(&self) -> f64
pub const fn get_chroma(&self) -> f64
0 <= new_chroma <= ?
After setting chroma, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
Sourcepub fn set_chroma(&mut self, value: f64)
pub fn set_chroma(&mut self, value: f64)
0 <= new_chroma <= ?
After setting chroma, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
Sourcepub const fn get_tone(&self) -> f64
pub const fn get_tone(&self) -> f64
Lightness. Ranges from 0 to 100.
0 <= new_tone <= 100; invalid values are corrected.
After setting tone, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
Sourcepub fn set_tone(&mut self, value: f64)
pub fn set_tone(&mut self, value: f64)
Lightness. Ranges from 0 to 100.
0 <= new_tone <= 100; invalid values are corrected.
After setting tone, the color is mapped from HCT to the more
limited sRgb gamut for display. This will change its Argb/integer
representation. If the HCT color is outside of the sRgb gamut, chroma
will decrease until it is inside the gamut.
pub fn new(argb: Argb) -> Self
Sourcepub fn from(hue: f64, chroma: f64, tone: f64) -> Self
pub fn from(hue: f64, chroma: f64, tone: f64) -> Self
0 <= hue < 360; invalid values are corrected.
0 <= chroma <= ?; Informally, colorfulness. The color returned may be
lower than the requested chroma. Chroma has a different maximum for any
given hue and tone.
0 <= tone <= 100; informally, lightness. Invalid values are corrected.
Sourcepub fn in_viewing_conditions(self, vc: &ViewingConditions) -> Self
pub fn in_viewing_conditions(self, vc: &ViewingConditions) -> Self
Translate a color into different ViewingConditions.
Colors change appearance. They look different with lights on versus off, the same color, as in hex code, on white looks different when on black. This is called color relativity, most famously explicated by Josef Albers in Interaction of Color.
In color science, color appearance models can account for this and calculate the appearance of a color in different settings. HCT is based on CAM16, a color appearance model, and uses it to make these calculations.
See ViewingConditions for parameters affecting color appearance.
Trait Implementations§
impl Copy for Hct
impl Eq for Hct
Source§impl Ord for Hct
impl Ord for Hct
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for Hct
impl RefUnwindSafe for Hct
impl Send for Hct
impl Sync for Hct
impl Unpin for Hct
impl UnsafeUnpin for Hct
impl UnwindSafe for Hct
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.