flix

0.81.0

Color

enum Color with Eq, ToStringSource
case Rgb(Int32, Int32, Int32)

Colours and draw commands.

Plain immutable data shared by the Canvas effect and its handlers. Nothing in this file knows that a window exists, which is what lets tests assert on what would be drawn without opening one.

Instances

Eq, ToString

Definitions

def black(): Color§ Source

Solid black color (RGB 0, 0, 0).

def blueOf(c: Color): Int32§ Source

The blue channel, clamped to 0..255.

def contrastRatio(a: Color, b: Color): Float64§ Source

The WCAG 2.1 contrast ratio between two colours, from 1.0 to 21.0.

Order does not matter. As a rule of thumb, body text needs at least 4.5 and shapes and large text need at least 3.0 to stay legible.

def greenOf(c: Color): Int32§ Source

The green channel, clamped to 0..255.

def grey(v: Int32): Color§ Source

Creates a grayscale color with identical red, green, and blue components.

def luminance(c: Color): Float64§ Source

Relative luminance, from 0.0 (black) to 1.0 (white), per WCAG 2.1.

def redOf(c: Color): Int32§ Source

The red channel, clamped to 0..255.

def white(): Color§ Source

Solid white color (RGB 255, 255, 255).