W3cubDocs

/Web APIs

WebGLRenderingContext: drawingBufferColorSpace property

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(glP3.COLOR_BUFFER_BIT);

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
drawingBufferColorSpace 104 104 No No 90 16.4 104 104 No 71 16.4 20.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawingBufferColorSpace