A
A
alekseivanov2018-05-28 14:07:50
css
alekseivanov, 2018-05-28 14:07:50

How to eliminate differences between Javascript canvas and css colors?

On the site, I need the color picker function, that is, the ability to copy the color of the pixel that is under the cursor.
To do this, I use the canvas and the ctx.getImageData function and get an array with the desired rgba colors.
Using this array, you can repeat the color within the canvas itself, but if you try to apply this color to css styles, the color will be different.
As I understand it, there are differences between canvas color scheme and css. How to build a javascript function that would eliminate these differences?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question