pub struct Hsv {
pub hue: Angle,
pub saturation: Ratio,
pub value: Ratio,
pub alpha: Ratio,
}Expand description
A color in the HSV (hue, saturation, value) color space.
The color.hsv constructor in Typst.
See the Typst documentation.
§Examples
use typwire::{Hsv, Ratio, initiate_protocol};
initiate_protocol!();
#[typwire::export]
fn value(color: Hsv) -> Result<Ratio, String> {
Ok(color.value)
}Fields§
§hue: AngleThe hue component of the color.
saturation: RatioThe saturation component of the color.
value: RatioThe value (brightness) component of the color.
alpha: RatioThe alpha (transparency) component of the color.
Implementations§
Source§impl Hsv
impl Hsv
Sourcepub const fn new(
hue: Angle,
saturation: Ratio,
value: Ratio,
alpha: Ratio,
) -> Self
pub const fn new( hue: Angle, saturation: Ratio, value: Ratio, alpha: Ratio, ) -> Self
Creates a new Hsv color with the given hue, saturation, value, and alpha components.
§Examples
use typwire::{Angle, Hsv, Ratio};
let h = Hsv::new(
Angle::new(0.0),
Ratio::new(1.0),
Ratio::new(1.0),
Ratio::new(1.0),
);
assert_eq!(h.value, Ratio::new(1.0));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hsv
impl<'de> Deserialize<'de> for Hsv
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Hsv
impl Typwire for Hsv
Auto Trait Implementations§
impl Forget for Hsv
impl Freeze for Hsv
impl Move for Hsv
impl RefUnwindSafe for Hsv
impl Send for Hsv
impl Sync for Hsv
impl Unpin for Hsv
impl UnsafeUnpin for Hsv
impl UnwindSafe for Hsv
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