[][src]Struct polyhorn_ui::color::Color

pub struct Color { /* fields omitted */ }

A color in a color-space with an associated alpha channel.

Implementations

impl Color[src]

pub fn rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color[src]

This function returns a new translucent color in the sRGB color space with the given coordinates and alpha channel.

pub fn rgb(red: u8, green: u8, blue: u8) -> Color[src]

This function returns a new opaque color in the sRGB color space with the given coordinates.

pub fn hexa(hex: u32, alpha: f32) -> Color[src]

This function returns a new translucent color in the sRGB color space with the given hex-encoded coordinates.

pub fn hex(hex: u32) -> Color[src]

This function returns a new opaque color in the sRGB color space with the given hex-encoded coordinates.

pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Color[src]

This function returns a new translucent color in the sRGB color space with the given coordinates after converting from the alternative HSL representation to RGB.

pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Color[src]

This function returns a new opaque color in the sRGB color space with the given coordinates after converting from the alternative HSL representation to RGB.

pub fn display_p3_rgba(red: u8, green: u8, blue: u8, alpha: f32) -> Color[src]

This function returns a new translucent color in the Display-P3 color space with the given coordinates and alpha channel.

pub fn display_p3_rgb(red: u8, green: u8, blue: u8) -> Color[src]

This functions returns a new opaque color in the Display-P3 color space with the given coordinates.

pub fn transparent() -> Color[src]

This function returns an unbiased transparent color. Specifically, when blending a non-transparent color with a transparent color, the resulting color will have the same color space and coordinate as the non-transparent color, and only the alpha channel will be blended.

pub fn alpha(&self) -> f32[src]

This function returns the additional alpha-component of this color.

pub fn mix(self, other: Color, factor: f32) -> Color[src]

Blends the given color with another color using the given factor (between 0.0 and 1.0).

pub fn to_display_p3(&self) -> DisplayP3a[src]

This function converts the color to the Display-P3 color space (if necessary) and returns the result.

pub fn to_srgb(&self) -> Srgba[src]

This function converts the color to the sRGB color space (if necessary) and returns the result.

pub fn to_hex(&self) -> u32[src]

Converts this color to sRGB and returns the resulting hex code.

Trait Implementations

impl Clone for Color[src]

impl Copy for Color[src]

impl Debug for Color[src]

impl Default for Color[src]

impl FromStr for Color[src]

type Err = Error

The associated error which can be returned from parsing.

impl NamedColor for Color[src]

impl PartialEq<Color> for Color[src]

impl StructuralPartialEq for Color[src]

Auto Trait Implementations

impl RefUnwindSafe for Color

impl Send for Color

impl Sync for Color

impl Unpin for Color

impl UnwindSafe for Color

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.