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.
This property can have the following values:
If an invalid value is specified, then the value of drawingBufferColorSpace
will remain unchanged.
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);