pub struct HSVColor<T, A = T> {
pub h: T,
pub s: T,
pub v: T,
pub a: A,
}Expand description
A color in the HSV Color Space.
Fields§
§h: THue is a degree on the color_parser wheel from [0f32, 360f32).
0 is red, 120 is green, 240 is blue.
s: TSaturation is a percentage value in [0f32, 1f32].
0% means a shade of gray and 100% is the full color_parser.
v: TSaturation is a percentage value in [0f32, 1f32].
0% means a shade of gray and 100% is the full color_parser.
a: AAlpha is a percentage value in [0f32, 1f32].
0% is transparent, 100% is opaque.
Implementations§
Source§impl HSVColor<f32>
impl HSVColor<f32>
Sourcepub fn new(h: f32, s: f32, v: f32, a: f32) -> HSVColor<f32>
pub fn new(h: f32, s: f32, v: f32, a: f32) -> HSVColor<f32>
Create a new color in the HSV Color Space.
§Warning
The raw value is created, and the legality of the data will not be verified
The legal HSVA32 range is:
h:[0°, 360°)s:[0%, 100%]v:[0%, 100%]a:[0%, 100%]
§Examples
let hsva32 = HSVA32::new(720.0, 100.0, 100.0, 100.0);
assert_eq!(hsva32.h, 0.0);Source§impl<T, A> HSVColor<T, A>
impl<T, A> HSVColor<T, A>
Sourcepub fn with_saturation(self, s: T) -> HSVColor<T, A>
pub fn with_saturation(self, s: T) -> HSVColor<T, A>
Build a new color with the given saturation.
Sourcepub fn with_brightness(self, v: T) -> HSVColor<T, A>
pub fn with_brightness(self, v: T) -> HSVColor<T, A>
Build a new color with the given brightness.
Sourcepub fn with_alpha(self, a: A) -> HSVColor<T, A>
pub fn with_alpha(self, a: A) -> HSVColor<T, A>
Build a new color with the given α.
Trait Implementations§
impl<T, A> Copy for HSVColor<T, A>
impl<T, A> StructuralPartialEq for HSVColor<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for HSVColor<T, A>
impl<T, A> RefUnwindSafe for HSVColor<T, A>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<T, A> Send for HSVColor<T, A>
impl<T, A> Sync for HSVColor<T, A>
impl<T, A> Unpin for HSVColor<T, A>
impl<T, A> UnwindSafe for HSVColor<T, A>where
T: UnwindSafe,
A: UnwindSafe,
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