Color management for WebGL2Baseline · Newly available
The drawingBufferColorSpace and unpackColorSpace properties of WebGL2RenderingContext sets the color representation for the buffer and imported textures, such as "srgb" or "display-p3".
Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Oct 29, 2024.
Browser support
DesktopChrome
1–103Not supported
104+Supportedsince Aug 2, 2022
Current: 155Edge
12–103Not supported
104+Supportedsince Aug 5, 2022
Current: 154Firefox
1–131Not supported
132+Supportedsince Oct 29, 2024
Current: 157Safari
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27MobileChrome Android
18–103Not supported
104+Supportedsince Aug 2, 2022
Current: 155Firefox Android
4–131Not supported
132+Supportedsince Oct 29, 2024
Current: 157Safari iOS
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27How to use
Every current browser supports this, but it only became Baseline on Oct 29, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.
Example
Full syntax and examples are on MDN: drawingBufferColorSpace.
Feature detection
JS · check before using
if ("WebGL2RenderingContext" in globalThis && "drawingBufferColorSpace" in WebGL2RenderingContext.prototype) {
// WebGL2RenderingContext.drawingBufferColorSpace is available
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| WebGL2RenderingContext.drawingBufferColorSpace | 104 | 104 | 132 | 16.4 | 104 | 132 | 16.4 |
| WebGL2RenderingContext.unpackColorSpace | 104 | 104 | 132 | ✕ | 104 | 132 | ✕ |