pub trait SetColor<S>: Sized
where S: Component,
{ // Required method fn rgba_mut(&mut self) -> &mut Option<LinSrgba<S>>; // Provided methods fn color<C>(self, color: C) -> Self where C: IntoLinSrgba<S> { ... } fn rgb<T>(self, r: T, g: T, b: T) -> Self where T: Component, S: Float { ... } fn rgb8(self, r: u8, g: u8, b: u8) -> Self where S: Float { ... } fn rgba<T>(self, r: T, g: T, b: T, a: T) -> Self where T: Component, S: Float { ... } fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Self where S: Float { ... } fn hsl(self, h: S, s: S, l: S) -> Self where S: Float + Into<RgbHue<S>> { ... } fn hsla(self, h: S, s: S, l: S, a: S) -> Self where S: Float + Into<RgbHue<S>> { ... } fn hsv(self, h: S, s: S, v: S) -> Self where S: Float { ... } fn hsva(self, h: S, s: S, v: S, a: S) -> Self where S: Float { ... } fn gray<T>(self, g: T) -> Self where T: Component, S: Float { ... } }
Expand description

Nodes that support setting colors.

Required Methods§

source

fn rgba_mut(&mut self) -> &mut Option<LinSrgba<S>>

Provide a mutable reference to the RGBA field which can be used for setting colors.

Provided Methods§

source

fn color<C>(self, color: C) -> Self
where C: IntoLinSrgba<S>,

Specify a color.

This method supports any color type that can be converted into RGBA.

Colors that have no alpha channel will be given an opaque alpha channel value 1.0.

source

fn rgb<T>(self, r: T, g: T, b: T) -> Self
where T: Component, S: Float,

Specify the color via red, green and blue channels.

source

fn rgb8(self, r: u8, g: u8, b: u8) -> Self
where S: Float,

Specify the color via red, green and blue channels as bytes

source

fn rgba<T>(self, r: T, g: T, b: T, a: T) -> Self
where T: Component, S: Float,

Specify the color via red, green, blue and alpha channels.

source

fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Self
where S: Float,

Specify the color via red, green, blue and alpha channels as bytes

source

fn hsl(self, h: S, s: S, l: S) -> Self
where S: Float + Into<RgbHue<S>>,

Specify the color via hue, saturation and luminance.

If you’re looking for HSV or HSB, use the hsv method instead.

The given hue expects a value between 0.0 and 1.0 where 0.0 is 0 degress and 1.0 is 360 degrees (or 2 PI radians).

See the wikipedia entry for more details on this color space.

source

fn hsla(self, h: S, s: S, l: S, a: S) -> Self
where S: Float + Into<RgbHue<S>>,

Specify the color via hue, saturation, luminance and an alpha channel.

If you’re looking for HSVA or HSBA, use the hsva method instead.

The given hue expects a value between 0.0 and 1.0 where 0.0 is 0 degress and 1.0 is 360 degrees (or 2 PI radians).

See the wikipedia entry for more details on this color space.

source

fn hsv(self, h: S, s: S, v: S) -> Self
where S: Float,

Specify the color via hue, saturation and value (brightness).

This is sometimes also known as “hsb”.

The given hue expects a value between 0.0 and 1.0 where 0.0 is 0 degress and 1.0 is 360 degrees (or 2 PI radians).

See the wikipedia entry for more details on this color space.

source

fn hsva(self, h: S, s: S, v: S, a: S) -> Self
where S: Float,

Specify the color via hue, saturation, value (brightness) and an alpha channel.

This is sometimes also known as “hsba”.

The given hue expects a value between 0.0 and 1.0 where 0.0 is 0 degress and 1.0 is 360 degrees (or 2 PI radians).

See the wikipedia entry for more details on this color space.

source

fn gray<T>(self, g: T) -> Self
where T: Component, S: Float,

Specify the color as gray scale

The given g expects a value between 0.0 and 1.0 where 0.0 is black and 1.0 is white

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<S> SetColor<S> for Option<LinSrgba<S>>
where S: Component,

source§

fn rgba_mut(&mut self) -> &mut Option<LinSrgba<S>>

Implementors§