Handle Wide-gamut (Display P3) images in the browser
masterBy default, colors are read and reported in sRGB. For P3-tagged/wide-gamut images, use the gamut option to preserve saturation.
gamut: 'display-p3': Forces reading through a P3 canvas and reports P3 colors.gamut: 'auto': Reports P3 only if the image uses out-of-sRGB colors; otherwise behaves like sRGB.
Note on compatibility: .rgb(), .array(), and .hex() always return sRGB (gamut-mapped). For raw P3 components, use .oklch() or .css(). In Node.js, output is currently sRGB.
// Force P3
const palette = await getPalette(img, { gamut: 'display-p3' });
palette[0].css(); // 'color(display-p3 0.92 0.2 0.14)'
palette[0].gamut; // 'display-p3'
// Auto
const auto = await getPalette(img, { gamut: 'auto' });