contrast

Easily calculate color contrast ratios  https://p.ce9e.org/contrast/
git clone https://git.ce9e.org/contrast.git

commit
f91109cee68c92ca10b01adc9ae8653040ab9d1a
parent
44e2421f1d71a375f5191d82f73ac88d732667b8
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-07 10:59
fix: clear canvas on parseColor

fixes repeated paring of transparent colors

Diffstat

M contrast.js 1 +

1 files changed, 1 insertions, 0 deletions


diff --git a/contrast.js b/contrast.js

@@ -67,6 +67,7 @@ var makeGradient = function(scores) {
   67    67 
   68    68 var parseColor = function(s) {
   69    69   context.fillStyle = s;
   -1    70   context.clearRect(0,0,1,1);
   70    71   context.fillRect(0,0,1,1);
   71    72   var data = context.getImageData(0, 0, 1, 1, {colorSpace: 'srgb'}).data;
   72    73   return [data[0], data[1], data[2], data[3] / 255];