1 stable release

1.0.0 Feb 6, 2021

#3 in #perceptual

CC-PDDC license

6KB
93 lines

Convert sRGB to Oklab perceptual color space

Simple Rust implementation of the Oklab color space conversion routines based on the reference implementation in the blog post.

Mixing of colors in the Oklab color space is meant to give more pleasing gradients.

API

use oklab::*;
let Oklab {l, a, b} = srgb_to_oklab(RGB {r, g, b});
let rgb = oklab_to_srgb(Oklab {l, a, b});

Oklab components are floats. l is in range 0 to 1, and a/b are small numbers that can be negative.


lib.rs:

What is Oklab color space?.

Dependencies

~69KB