Started by Peter DanielsSep 28, 2021

Open
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

Neel Dey replied 5 days 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").

Peter Daniels replied 3 days ago0 likes0 dislikes

Thanks for your feedback.

You must be Logged in to reply
Trending Technologies
15
Software39
DevOps45
Frontend Development24
Backend Development20
Server Administration17
Linux Administration24
Data Center24
Sentry24
Terraform21
Ansible46
Docker28
Penetration Testing14
Kubernetes17
NGINX19
JenkinsX17
Techiio

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:

facebooklinkdeintwitter

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Copyright techiio.com @2020 Kolkata, India
made with by Abhishek & Priyanka Jalan
Copyright techiio.com @2020
made with by Abhishek & Priyanka Jalan