LAB conversions

Interactive color checker for LAB conversions.
Read more : https://drafts.csswg.org/css-color-4/#binsearch

This code is not written for performance and will run very slowly on older/under powered machines.


LAB converted to sRGB.

Colors out of gamut for sRGB (with outline) will have been adjusted through chroma reduction in OKLCH.

LAB rendered natively.
(only in Safari >= 15)

It seems as if Safari displays LAB with what is available in Display-P3.
Colors out of gamut (with outline) for Display-P3 might be clipped or modified in other ways.

LAB converted to sRGB with coloraide.

Code used to convert LAB to sRGB with coloraide :


	# python3 -m pip install coloraide
	
	from coloraide import Color

	l = 50;
	a = 0;
	b = 0;

	color = Color('lab({}% {} {})'.format(l, a, b));

	color.convert('oklch').fit('srgb', method='lch-chroma').convert('srgb').fit('srgb', method='clip').coords();