MDN self-hosted library · e01.org

VideoColorSpace: toJSON() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const colorSpace = new VideoColorSpace({
  primaries: "bt709",
  transfer: "bt709",
  matrix: "bt709",
  fullRange: true,
});

const json = colorSpace.toJSON();
console.log(json);
// { fullRange: true, matrix: "bt709", primaries: "bt709", transfer: "bt709" }
console.log(typeof json); // "object"
js
console.log(JSON.stringify(colorSpace));