WebGLRenderingContext: drawingBufferColorSpace property

Baseline 2024
Newly available

Since October 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Note: This feature is available in Web Workers.

The WebGLRenderingContext.drawingBufferColorSpace property specifies the color space of the WebGL drawing buffer. Along with the default (srgb), the display-p3 color space can be used.

See WebGLRenderingContext.unpackColorSpace for specifying the color space for textures.

Value

This property can have the following values:

If an invalid value is specified, then the value of drawingBufferColorSpace will remain unchanged.

Examples

Setting the drawing buffer color space to draw a Display P3 red

js
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
gl.drawingBufferColorSpace = "display-p3";
gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);

Specifications

Specification
WebGL Specification
# DOM-WebGLRenderingContext-drawingBufferColorSpace

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
drawingBufferColorSpace
Chrome – Full support
Chrome 104 (Release date: 2022-08-02)
footnote Full support
Edge – Full support
Edge 104 (Release date: 2022-08-05)
footnote Full support
Firefox – Partial support
Firefox 127 – 129 (Release date: 2024-06-11)
footnote Removed in 130 and later
footnote Partial support
footnote Accidental early exposure with no functionality.
Firefox – Full support
Firefox 132 (Release date: 2024-10-29)
footnote Full support
Opera – Full support
Opera 90 (Release date: 2022-08-18)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 104 (Release date: 2022-08-02)
footnote Full support
Firefox for Android – Partial support
Firefox for Android 127 – 129 (Release date: 2024-06-11)
footnote Removed in 130 and later
footnote Partial support
footnote Accidental early exposure with no functionality.
Firefox for Android – Full support
Firefox for Android 132 (Release date: 2024-10-29)
footnote Full support
Opera Android – Full support
Opera Android 71 (Release date: 2022-09-16)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 20 (Release date: 2023-02-10)
footnote Full support
WebView Android – Full support
WebView Android 104 (Release date: 2022-08-02)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also