Techiio-author
Started by Peter DanielsSep 28, 2021

Closed
How to specify the color space for canvas in JavaScript?

2 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWES SHARE

What is the default color space used in JS canvas?

How can I change the color space used for rendering an HTML canvas element?

2 Replies

Techiio-commentatorNeel Dey replied 5 months ago0 likes0 dislikes

Starting in Chrome version 94, when creating a canvas 2d object, you can now provide an option object argument specifying your desired color space ("srgb" or "display-p3") to use:

let canvas = document.getElementById("myCanvas");
let options = { colorSpace: "display-p3" };
const context = canvas.getContext("2d", options);

Also, note that the default color space used for canvas elements is now officially (rather than conventionally and implicitly) sRGB ("srgb").

Techiio-commentatorPeter Daniels replied 5 months ago0 likes0 dislikes

Thanks for your feedback.

This thread is closed by Peter Daniels
Trending Technologies
15
Software41
DevOps47
Frontend Development24
Backend Development20
Server Administration17
Linux Administration26
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance