oddbird / oddcontrast

https://www.oddcontrast.com/
BSD 3-Clause "New" or "Revised" License
28 stars 1 forks source link

Take into account foreground alpha for contrast #120

Open jamesnw opened 1 year ago

jamesnw commented 1 year ago

Description

Calculates a contrast ratio for colors with an alpha channel by mixing the color in the srgb space. More info on why srgb instead of the color's space can be found in this comment.

Steps to test/reproduce

Test contrast in different spaces with different alpha levels.

Show me

I added the premultiplied color below the foreground color, as it is in essence a 3rd color that is generated.

image

I've added 2 boxes that show the color as blended by your display and the result of the premultiplication mix in srgb. We may want to show this info somewhere, but likely not where it is.

image

netlify[bot] commented 1 year ago

Deploy Preview for oddcontrast ready!

Name Link
Latest commit 84d573bed39b4a5305f43c51cfca0e9510136f09
Latest deploy log https://app.netlify.com/sites/oddcontrast/deploys/64de7abc999d100008fc868c
Deploy Preview https://deploy-preview-120--oddcontrast.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.