masakudamatsu / triangulum-color-picker

A front-end web app to pick a tint/tone/shade of hues more logically and more intuitively than the standard color pickers
https://triangulum.netlify.app
MIT License
2 stars 1 forks source link

Correct the formula to calculate relative luminance #201

Open masakudamatsu opened 10 months ago

masakudamatsu commented 10 months ago

Problem

On May 2021, the formula to calculate relative luminance was updated:

Before May 2021 the value of 0.04045 in the definition was different (0.03928). It was taken from an older version of the specification and has been updated. It has no practical effect on the calculations in the context of these guidelines. — https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html#dfn-relative-luminance

However, the code for calculating relative luminance uses 0.03928.

Solution

Replace 0.03928 with 0.04045 in line 18 of src/utils/getContrastRatio.js