Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How to specify color space for canvas in JavaScript?

What is the default color space used in JS canvas?

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

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").

You can watch the Chrome YouTube announcement and read its feature specification.
As noted in the YouTube video, this feature is going to be available in Firefox and Safari as well.

Related links:

  • Canvas color space proposal on GitHub
  • HTML color space specification

Thanks to isherwood and Kaiido for their comments.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!