v155 · miscellaneous · enabled by default
PredefinedColorSpace srgb-linear and display-p3-linear
From Chrome 155, the PredefinedColorSpace enum used by canvas APIs accepts two additional values defined by CSS Color 4: "srgb-linear" and "display-p3-linear". They give a 2D canvas (and ImageData) a linear-light working color space — pixel values proportional to luminance, with no transfer-function gamma — which is what physically-based rendering, anti-aliasing, decimation, and interpolation pipelines expect. Previously only "srgb" and "display-p3" (both gamma-encoded) were available.
at a glance
| Shipped in | Chrome 155 (desktop, Android, Android WebView; no iOS milestone recorded) — filed under “Enabled by default” in the milestone=155 listing (fetched 2026-10-11); per-platform milestones from the ChromeStatus API record and the Intent’s “Estimated milestones” |
|---|---|
| Runtime flag | ColorSpacePredefinedLinearSpaces, status stable in Blink’s runtime_enabled_features.json5 (its comment cites this ChromeStatus entry; verified 2026-10-11). Finch feature name: ColorSpacePredefinedLinearSpaces, “will ship enabled for all users” per the Intent |
| Specification | HTML Standard §4.12.5.4 — color spaces and color space conversion; the color spaces themselves are defined in CSS Color 4 — srgb-linear and display-p3-linear |
| Tracking bug | issuetracker.google.com/454152417 |
| Intent to Ship | blink-dev thread, also archived as mail-archive msg17379 |
| TAG review | w3ctag/design-reviews#1194 (“for the full HDR on the web project, which this is a part of”; issues addressed) |
| Web platform tests | getContextAttributes.html (set/get) · 2d.color.space draw-and-readback tests (both named by the Intent) |
| ChromeStatus | 5122501071994880 — PredefinedColorSpace srgb-linear and display-p3-linear (blink component Blink>Canvas) |
what changed
The PredefinedColorSpace enumeration “is used to specify the color space of the canvas's backing store” (HTML Standard §4.12.5.4). The HTML Standard now defines four values; Chrome 155 adds support for the two linear ones:
| Enum value | Color space (CSS Color 4) | Chrome support |
|---|---|---|
"srgb" | sRGB (gamma-encoded; the default) | Since canvas color management shipped in 92 (BCD) |
"display-p3" | Display P3 (gamma-encoded, wide gamut) | Since 92 (same BCD entry) |
"srgb-linear" | Linear-light sRGB — sRGB primaries, identity transfer function | New in 155 |
"display-p3-linear" | Linear-light Display P3 — P3 primaries, identity transfer function | New in 155 |
In a linear working space, arithmetic on pixel values is arithmetic on light: blending two pixels averages their luminance instead of their gamma-encoded codes. That is why the Intent’s motivation calls linear spaces “extremely commonly used in applications with connections to physical light rendering (e.g., games) or spatial processing (e.g., decimation, anti-aliasing, and interpolation)”. Color space conversion is applied when the canvas is rendered to the output device: “Color space conversion must be applied to the canvas's backing store when rendering the canvas to the output device” (HTML Standard, same section), so a linear backing store still displays correctly. Note that an 8-bit-per-channel backing store (colorType: "unorm8", the default) quantizes linear values coarsely in the dark range; the companion CanvasColorType enum ("unorm8", "float16") exists for that reason — the two settings are independent members of the same settings dictionary.
syntax
No new members are added — the change widens the value set of an existing enum. IDL verbatim from the HTML Standard (fetched 2026-10-11):
enum PredefinedColorSpace { "srgb", "srgb-linear", "display-p3", "display-p3-linear" };
The enum is consumed by the 2D context settings dictionary — passed as the second argument of canvas.getContext("2d", settings) (and OffscreenCanvas.getContext("2d", settings)) and read back with getContextAttributes():
dictionary CanvasRenderingContext2DSettings {
boolean alpha = true;
boolean desynchronized = false;
PredefinedColorSpace colorSpace = "srgb";
CanvasColorType colorType = "unorm8";
boolean willReadFrequently = false;
};
enum CanvasColorType { "unorm8", "float16" };
and by ImageData, via the settings dictionary accepted by the ImageData constructor and by createImageData() / getImageData(), and reflected by the read-only ImageData.colorSpace attribute (IDL verbatim from HTML Standard §ImageData):
dictionary ImageDataSettings {
PredefinedColorSpace colorSpace;
ImageDataPixelFormat pixelFormat = "rgba-unorm8";
};
Because PredefinedColorSpace is a Web IDL enumeration, passing a string outside the supported set to a dictionary member of this type throws a TypeError at the call site (Web IDL — enumeration types) — in a browser that hasn’t shipped this feature, "srgb-linear" is exactly such a string. That makes support detectable with a try/catch (see examples). The same enum type is also referenced by the WebGL (drawingBufferColorSpace, unpackColorSpace) and WebGPU (GPUCanvasConfiguration.colorSpace) specifications; whether Chrome 155 accepts the linear values on those surfaces is not stated in the sources read here, which document the canvas-2D and ImageData entry points named by the ChromeStatus record.
examples
Requesting a linear-light 2D canvas, with honest fallback (snippet gendn-derived from the IDL above):
const canvas = document.querySelector('canvas');
let ctx;
try {
// Throws TypeError where "srgb-linear" isn't a known enum value.
ctx = canvas.getContext('2d', {
colorSpace: 'srgb-linear',
colorType: 'float16', // avoid 8-bit banding in linear light
});
} catch {
ctx = canvas.getContext('2d'); // gamma-encoded srgb fallback
}
// Confirm what the context actually holds:
console.log(ctx.getContextAttributes().colorSpace);
// "srgb-linear" in Chrome 155+, "srgb" on the fallback path
Why linear matters — a 50% blend of pure red and pure green. In gamma-encoded sRGB the midpoint is a muddy dark yellow; in linear light it keeps physical brightness (then converts for display):
// In "srgb-linear", gradient midpoints and globalAlpha compositing
// average LIGHT, not gamma codes:
const g = ctx.createLinearGradient(0, 0, 256, 0);
g.addColorStop(0, 'color(srgb-linear 1 0 0)');
g.addColorStop(1, 'color(srgb-linear 0 1 0)');
ctx.fillStyle = g;
ctx.fillRect(0, 0, 256, 64);
// Reading pixels back in the same space:
const data = ctx.getImageData(0, 0, 256, 64, { colorSpace: 'srgb-linear' });
console.log(data.colorSpace); // "srgb-linear"
srgb and srgb-linear backing stores. Sibling concept demos (all 200): context settings & readback, ImageData round trip, additive spotlights, detection traps.Source: chrome-platform-showcasecolor(srgb-linear …) syntax per CSS Color 4; snippets gendn-derived (labelled), exercised live by the embedded showcase demo
browser compatibility
BCD has no subfeature for the linear values yet: the BCD options_colorSpace_parameter and ImageData.colorSpace entries (package data 8.1.5, 2026-10-08) record only the colorSpace option itself. The table below is therefore interim, built from the ChromeStatus record and the Intent:
| Browser | "srgb-linear" / "display-p3-linear" | Notes |
|---|---|---|
| Chrome | 155 (interim: ChromeStatus, not yet BCD) | Desktop, Android, Android WebView per the ChromeStatus API record; no iOS milestone recorded. Flag ColorSpacePredefinedLinearSpaces is stable |
| Edge | Unknown | Chromium-based, expected to inherit at its 155-based release; no source read here records an Edge version |
| Firefox | No | Mozilla position: standards-positions#1453, “No signal” per the ChromeStatus record — and Firefox has never shipped the prerequisite colorSpace setting (BCD: version_added: false) |
| Safari | Implemented; release unknown | “Suggested by WebKit, already implemented in WebKit” per the Intent to Ship; no shipping Safari version is recorded in the sources read |
Prerequisite — the colorSpace context/ImageData option itself, per BCD (verified 2026-10-11): Chrome 92, Safari 15.2, Firefox not supported, Edge mirrors Chrome. | ||
Treat the linear spaces as a progressive enhancement: request them in a try/catch, verify with getContextAttributes(), and keep the gamma-encoded path working. The Baseline web feature this belongs to (canvas-2d-color-management) is Limited availability.
security and privacy
The Intent to Ship lists Security: “None” and Activation: “None”. The change adds no new data source: it widens an existing enum on surfaces the page already controls, and the backing-store contents remain subject to the canvas’s existing origin-clean rules. As with any new enum value, which values a browser accepts is observable (the TypeError detection path above), adding at most one more bit to the already-detectable canvas color-management surface; the sources read record no other privacy considerations.
specifications
see also
- MDN: HTMLCanvasElement.getContext() and MDN: ImageData.colorSpace — the existing
colorSpaceoption (MDN does not yet document the linear values; checked 2026-10-11) - chrome-platform-showcase: linear color space demos (five concepts, all routes 200)
- ChromeStatus — PredefinedColorSpace srgb-linear and display-p3-linear (5122501071994880)
- blink-dev Intent to Ship · tracking bug 454152417
- ChromeStatus — the companion CSS
display-p3-linearentry (flagColorSpaceDisplayP3Linear, alsostable) · rec2100-linear (still experimental) — both from the same runtime-flag file