Skip to main content

Colour

struct Colour {
// from native code
r: f32
g: f32
b: f32
a: f32
}

Fields

r

r: f32

The red component of this colour, in the range from 0.0 to 1.0.

g

g: f32

The green component of this colour, in the range from 0.0 to 1.0.

b

b: f32

The blue component of this colour, in the range from 0.0 to 1.0.

a

a: f32

The alpha component of this colour, i.e. its transparency, in the range from 0.0 to 1.0.

Methods

from_proportions

fn from_proportions(r: f32, g: f32, b: f32, a: f32) -> Colour

from_bytes

fn from_bytes(r: u8, g: u8, b: u8, a: u8) -> Colour

from_bytes_opaque

fn from_bytes_opaque(r: u8, g: u8, b: u8) -> Colour

to_linear_rgb

fn to_linear_rgb(self) -> Colour

Convert a colour from SRGB to linear.