From 131d6ea6dc6b7bcdcb698dff2572531d6398ead7 Mon Sep 17 00:00:00 2001 From: dontwanttothink Date: Sun, 17 May 2026 14:45:42 -0500 Subject: [PATCH] Register the XYZ-D65 color space Fixes #8806 --- src/color/p5.Color.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/color/p5.Color.js b/src/color/p5.Color.js index 29b5996fb3..16fb7d5d6a 100644 --- a/src/color/p5.Color.js +++ b/src/color/p5.Color.js @@ -26,7 +26,9 @@ import { OKLCH as OKLCHSpace, contrastWCAG21, contrastAPCA, - P3 + P3, + + XYZ_D65 as XYZ_D65Space } from 'colorjs.io/fn'; import HSBSpace from './color_spaces/hsb.js'; @@ -1031,6 +1033,11 @@ function color(p5, fn, lifecycles){ p5.Color.addColorMode(OKLAB, OKLab); p5.Color.addColorMode(OKLCH, OKLCHSpace); + // The fundamental color space to which all colors can be converted (https://colorjs.io/docs/spaces#xyz-d65) + // This needs to be registered with color.js for interpolation to work + // reliably. + ColorSpace.register(XYZ_D65Space); + lifecycles.presetup = function(){ const pInst = this;