Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take into account foreground alpha for contrast #120

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jamesnw
Copy link
Contributor

@jamesnw jamesnw commented Aug 16, 2023

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

@jamesnw jamesnw linked an issue Aug 16, 2023 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Aug 16, 2023

Deploy Preview for oddcontrast ready!

Name Link
🔨 Latest commit 84d573b
🔍 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contrast ratios should account for alpha transparency
1 participant