[−][src]Struct duku::Hsb
Color bytes in HSB with alpha.
Makes it easier to handle/convert colors.
HSB is the same as HSV.
Examples
let red = Hsb::new(0, 100, 100);
Fields
h: u16
the hue component in range 0 to 360
s: u8
the saturation component in range 0 to 100
b: u8
the brightness component in range 0 to 100
a: u8
the alpha component
Implementations
impl Hsb
[src]
pub fn new(h: u16, s: u8, b: u8) -> Self
[src]
Create color
Converts components to correct ranges
pub const fn alpha(self, a: u8) -> Self
[src]
pub const fn shift(self, h: u16) -> Self
[src]
Create color, shifting the hue by value
Examples
let red = Hsb::new(360, 100, 100); let yellow = red.shift(60);
pub fn darken(self, v: u8) -> Self
[src]
Create color, darkening by some value
Examples
let red = Hsb::new(0, 100, 100); let dark_red = red.darken(5);
pub fn brighten(self, v: u8) -> Self
[src]
Create color, brightening by some value
Examples
let red = Hsb::new(0, 100, 50); let bright_red = red.brighten(5);
pub fn saturate(self, v: u8) -> Self
[src]
Create color, saturating by some value
Examples
let red = Hsb::new(0, 50, 100); let saturated_red = red.saturate(5);
pub fn desaturate(self, v: u8) -> Self
[src]
Create color, desaturating by some value
Examples
let red = Hsb::new(0, 100, 100); let desaturated_red = red.desaturate(5);
Trait Implementations
impl Clone for Hsb
[src]
impl Copy for Hsb
[src]
impl Debug for Hsb
[src]
impl Default for Hsb
[src]
impl Eq for Hsb
[src]
impl<'_> From<&'_ str> for Hsb
[src]
impl From<Hsb> for Rgb
[src]
impl From<Hsb> for Rgbf
[src]
impl From<Rgb> for Hsb
[src]
impl From<Rgbf> for Hsb
[src]
impl Hash for Hsb
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Mix for Hsb
[src]
impl PartialEq<Hsb> for Hsb
[src]
impl StructuralEq for Hsb
[src]
impl StructuralPartialEq for Hsb
[src]
Auto Trait Implementations
impl RefUnwindSafe for Hsb
impl Send for Hsb
impl Sync for Hsb
impl Unpin for Hsb
impl UnwindSafe for Hsb
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,