Struct Hct

Source
pub struct Hct { /* private fields */ }

Implementations§

Source§

impl Hct

Source

pub fn from(hue: f64, chroma: f64, tone: f64) -> Hct

Create an HCT color from hue, chroma, and tone.

§Arguments
  • hue: hue 0 <= hue < 360; invalid values are corrected.
  • chrome: chroma 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.
  • tone: tone 0 <= tone <= 100; invalid values are corrected.

returns: HCT representation of a color in default viewing conditions.

Source

pub fn from_int(argb: [u8; 4]) -> Hct

Create an HCT color from a color.

§Arguments
  • argb: ARGB representation of a color.

returns: HCT representation of a color in default viewing conditions

Source

pub fn hue(&self) -> f64

Source

pub fn chroma(&self) -> f64

Source

pub fn tone(&self) -> f64

Source

pub fn to_int(&self) -> [u8; 4]

Source

pub fn set_hue(&mut self, hue: f64)

Set the hue of this color. Chroma may decrease because chroma has a different maximum for any given hue and tone.

§Arguments
  • hue: 0 <= newHue < 360; invalid values are corrected.
Source

pub fn set_chroma(&mut self, chroma: f64)

Set the chroma of this color. Chroma may decrease because chroma has a different maximum for any given hue and tone.

§Arguments
  • chroma: 0 <= newChroma < ?
Source

pub fn set_tone(&mut self, tone: f64)

Set the tone of this color. Chroma may decrease because chroma has a different maximum for any given hue and tone.

§Arguments
  • tone: 0 <= newTone <= 100; invalid valids are corrected.

Trait Implementations§

Source§

impl Default for Hct

Source§

fn default() -> Hct

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Hct

§

impl RefUnwindSafe for Hct

§

impl Send for Hct

§

impl Sync for Hct

§

impl Unpin for Hct

§

impl UnwindSafe for Hct

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V