#color-space #hsl #perceptual #image-processing

oklab

OK Lab is a perceptually uniform color space for image processing. Improvement of CIELAB.

4 stable releases

1.1.2 Sep 1, 2024
1.1.0 Aug 27, 2024
1.0.1 Oct 4, 2023
1.0.0 Feb 6, 2021

#642 in Images

Download history 106/week @ 2024-07-30 104/week @ 2024-08-06 114/week @ 2024-08-13 115/week @ 2024-08-20 433/week @ 2024-08-27 185/week @ 2024-09-03 132/week @ 2024-09-10 258/week @ 2024-09-17 248/week @ 2024-09-24 123/week @ 2024-10-01 169/week @ 2024-10-08 209/week @ 2024-10-15 263/week @ 2024-10-22 184/week @ 2024-10-29 182/week @ 2024-11-05 152/week @ 2024-11-12

825 downloads per month
Used in 8 crates (7 directly)

CC-PDDC license

15KB
213 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 ligthness in range 0 to 1 (inclusive), and a/b colors are small numbers that can be negative.


lib.rs:

What is Oklab color space?

Dependencies

~170KB