Skip to content

Instantly share code, notes, and snippets.

View svgeesus's full-sized avatar

Chris Lilley svgeesus

View GitHub Profile

Gamut map test

let original= new Color("color(rec2020 0 0 1)");
let mapped = original.to("srgb");
mapped.toGamut({method:"clip"});
let lchresult = mapped.toGamut({method:"lch.chroma"});
lchresult.to("oklch");
let okresult = mapped.toGamut({method:"oklch.chroma"});

BT.2020 to Display P3 gamut mapping explorer

High chroma and high lightness colors, cyan and yellow

let color = new Color("red");

color-mix() examples for tests

let fromCol = new Color("color(display-p3 1 0 0)");
let toCol = new Color("green");
let mix= fromCol.range(toCol, {
    space: "oklab", // interpolation space
    outputSpace: "srgb"
});

color-mix tester

Also displays the intermediate results

let fromColor = new Color("red");
let toColor = new Color("green");
let p = 0.5;
let space="lch";
@svgeesus
svgeesus / slice42.svg
Created July 7, 2021 18:09
A very large, code-generated SVG of a slice through the LC plane of CIE LCH
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

DeltaE comparisons

From color-js/color.js#89

let goldenrod = new Color("goldenrod");

let cornflowerblue = new Color("cornflowerblue");
let royalblue = new Color("royalblue");