Struct bracket_color::hsv::HSV
source · pub struct HSV {
pub h: f32,
pub s: f32,
pub v: f32,
}Expand description
Represents an H/S/V triplet, in the range 0..1 (32-bit float) This can provide for a more natural color progression, and provides compatibility with HSV-based color systems.
Fields§
§h: f32Hue (range 0..1)
s: f32Saturation (range 0..1)
v: f32Value (range 0..1)
Implementations§
source§impl HSV
impl HSV
sourcepub const fn from_f32(h: f32, s: f32, v: f32) -> Self
pub const fn from_f32(h: f32, s: f32, v: f32) -> Self
Constructs a new HSV color, from 3 32-bit floats
§Arguments
h- The hue (0..1) to use.s- The saturation (0..1) to use.v- The value (0..1) to use.
sourcepub fn to_rgba(&self, alpha: f32) -> RGBA
pub fn to_rgba(&self, alpha: f32) -> RGBA
Converts to an RGBA value with a specified alpha level
sourcepub fn lerp(&self, color: Self, percent: f32) -> Self
pub fn lerp(&self, color: Self, percent: f32) -> Self
Progress smoothly between two colors, in the HSV color space.
§Arguments
color- the target color.percent- the percentage (0..1) of the starting (self) and target color to use.
§Example
use bracket_color::prelude::*;
let red = RGB::named(RED);
let blue = RGB::named(YELLOW);
let color = red.lerp(blue, 0.5);Trait Implementations§
impl Copy for HSV
impl StructuralPartialEq for HSV
Auto Trait Implementations§
impl RefUnwindSafe for HSV
impl Send for HSV
impl Sync for HSV
impl Unpin 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