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

oklab

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

2 stable releases

1.0.1 Oct 4, 2023
1.0.0 Feb 6, 2021

#560 in Images

Download history 467/week @ 2023-10-21 534/week @ 2023-10-28 213/week @ 2023-11-04 171/week @ 2023-11-11 129/week @ 2023-11-18 176/week @ 2023-11-25 216/week @ 2023-12-02 214/week @ 2023-12-09 304/week @ 2023-12-16 185/week @ 2023-12-23 131/week @ 2023-12-30 150/week @ 2024-01-06 192/week @ 2024-01-13 198/week @ 2024-01-20 215/week @ 2024-01-27 117/week @ 2024-02-03

746 downloads per month
Used in 6 crates (5 directly)

CC-PDDC license

7KB
111 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

~77KB