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

Transparency data not used in color display or contrast calcuations #5

Open
extra808 opened this issue Apr 18, 2022 · 1 comment
Open

Comments

@extra808
Copy link

When an input color includes transparency (#00636366, hsla(180, 100%, 19.4%, 0.4), rgba(0, 99, 99, 0.4), etc.) what's displayed in the output table is the color without transparency. Also, the contrast value calculated is for the color without transparency.

Transparency included in the text color complicates the contrast calculation but an accurate number is possible. When the background color includes transparency, the actual displayed color depends on the color(s) behind the element. I like what Lea Verou's Contrast Ratio site appears to do, calculates the contrast if the color behind the element is white, again if the color behind is black, then displays a contrast value halfway between with a +/- value, like error bars.

Until/unless the transparency data is included in the calculation, I think the directions should have a note about what happens to it.

@mherchel
Copy link
Owner

Thanks for the suggestion!

I'm using the https://github.com/bgrins/TinyColor library to do all the color calculations. It does have some support for transparency.

I wonder how common this is? In the meantime I don't mind creating a note.

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

No branches or pull requests

2 participants