APCA contrast #494
Unanswered
tobi-or-not-tobi
asked this question in
Q&A
Replies: 2 comments 1 reply
-
The 4.5:1 contrast ratio is specified by WCAG not by APCA. If you change the second line to the code below you'll get the contrast ratio you're looking for. const contrast = sourceColor.contrastWCAG21('black'); // 16.315049658050576 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks @lloydk I got myself confused 🤦 What output of APCA is considered enough contrast? Or isn't there such thing? I can imagine it depends, but I was hoping to have some reference for typical use cases. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using color.js to get the color contrast for black text on a solid background color. If the contrast is not good enough (4,5:1), I'd use white instead. I'm using these 2 lines:
I'm unsure how I should compare the return number should be compared to the minimum of
4,5:1
provided by APCA. What am I missing?Beta Was this translation helpful? Give feedback.
All reactions