Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

HUE_GUARD

#
const HUE_GUARD: f32 = 0.0001

Functions

gamma

#
fn gamma (
value: f32
) -> f32

inverse_gamma

#
fn inverse_gamma (
value: f32
) -> f32

srgb_to_linear_rgb

#
fn srgb_to_linear_rgb (
color: vec3<f32>
) -> vec3<f32>

linear_rgb_to_srgb

#
fn linear_rgb_to_srgb (
color: vec3<f32>
) -> vec3<f32>

linear_to_srgb

#
fn linear_to_srgb (
color: vec3<f32>
) -> vec3<f32>

srgb_to_linear

#
fn srgb_to_linear (
color: vec3<f32>
) -> vec3<f32>

oklab_to_linear_rgb

#
fn oklab_to_linear_rgb (
c: vec3<f32>
) -> vec3<f32>

okhsl_to_oklab

#
fn okhsl_to_oklab (
okhsl: vec3<f32>
) -> vec3<f32>

okhsl_to_linear_rgb

#
fn okhsl_to_linear_rgb (
okhsl: vec3<f32>
) -> vec3<f32>

linear_rgb_to_oklab

#

https://bottosson.github.io/posts/oklab/ - inverse of oklab_to_linear_rgb

fn linear_rgb_to_oklab (
c: vec3<f32>
) -> vec3<f32>

hsl_to_linear_rgb

#
fn hsl_to_linear_rgb (
hsl: vec3<f32>
) -> vec3<f32>

hsv_to_linear_rgb

#
fn hsv_to_linear_rgb (
hsva: vec3<f32>
) -> vec3<f32>

hwb_to_hsv

#
fn hwb_to_hsv (
hwb: vec3<f32>
) -> vec3<f32>

hwb_to_linear_rgb

#
fn hwb_to_linear_rgb (
hwb: vec3<f32>
) -> vec3<f32>

oklch_to_linear_rgb

#
fn oklch_to_linear_rgb (
c: vec3<f32>
) -> vec3<f32>

mix_oklch

#
fn mix_oklch (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_oklch_long

#
fn mix_oklch_long (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_hsl

#
fn mix_hsl (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_hsl_long

#
fn mix_hsl_long (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_okhsl

#
fn mix_okhsl (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_okhsl_long

#
fn mix_okhsl_long (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_hsv

#
fn mix_hsv (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

mix_hsv_long

#
fn mix_hsv_long (
a: vec3<f32>
, 
b: vec3<f32>
, 
t: f32
) -> vec3<f32>

hsv_to_rgb

#

rgb_to_hsv

#

okhsl_toe_inv

#
fn okhsl_toe_inv (
x: f32
) -> f32

okhsl_to_ST

#
fn okhsl_to_ST (
cusp: vec2<f32>
) -> vec2<f32>

okhsl_get_ST_mid

#

Polynomial approximation for mid-gamut ST values. Derived by optimization to ensure S_mid < S_max and T_mid < T_max.

fn okhsl_get_ST_mid (
a_: f32
, 
b_: f32
) -> vec2<f32>

okhsl_compute_max_saturation

#

Approximate max saturation using a polynomial, then refine with 1 step of Halley’s method. a and b must be normalized (a^2 + b^2 == 1).

fn okhsl_compute_max_saturation (
a: f32
, 
b: f32
) -> f32

okhsl_find_cusp

#
fn okhsl_find_cusp (
a: f32
, 
b: f32
) -> vec2<f32>

okhsl_find_gamut_intersection

#

Find intersection of the gamut boundary with the line from (L0, 0) to (L1, C1). Uses 1 step of Halley’s method.

fn okhsl_find_gamut_intersection (
a: f32
, 
b: f32
, 
L1: f32
, 
C1: f32
, 
L0: f32
, 
cusp: vec2<f32>
) -> f32

okhsl_get_Cs

#

Returns C_0, C_mid, Cmax for a given Oklab L and hue direction (a, b_).

fn okhsl_get_Cs (
L: f32
, 
a_: f32
, 
b_: f32
) -> vec3<f32>
Contents