> APCA says you don't need as much contrast
You can always specify the threshold if you want, e.g. "apcaContrast(color)) >= $targetContrast" after adjusting, depending on what you want to do.
It really is easy, just make sure you have enough color space.
re: just change APCA contrast target, that's separate from the Not Even Wrong stuff in the article. I didn't mean to imply APCA is wrong to say you need less contrast, but rather, that the article is wrong to conclude white has more contrast.
You are right, 0.18 is indeed perceptually closer to "middle gray" because the eye responds more sensitively to darker tones, so yeah, using a threshold closer to 0.18 makes more sense if we want to identify whether a color "feels" light or dark.
That said, 0.5 is a mathematical midpoint, but as I said, not aligned with how humans perceive brightness (edit: it is aligned).
Ultimately one could use 0.18-0.3 as threshold.
There are two physical quantities for luminance, relative, and perceptual, so that passed along a nugget for those not as wise as you who might not know that :) As you know and have mentioned, using 0.5 with the luminance calculation you mentioned, for relative luminance, would be in error (I hate being pedantic, but it's important for some parties, a11y is a de facto legal requirement for a lot of work, and 0.5 would be spot on for ensuring WCAG 2 text contrast as long as used with perceptual luminance, L*)
> doesn't align with human perception
It is 100% aligned with how humans perceive brightness, in fact, it's a stable work product dating back to the early 1900s.
> Ultimately one could use 0.18-0.3 as threshold
Perceptual luminance and relative luminance have precise mathematical definitions, one can be calculated in terms of the other.
If you need to hit contrast K with background color C, you won't be able to treat this as variable. What you pass along about it being variable is valuable, of course, in that, given K and C, output has a range, i.e. if contrast algo says you need +40 L* for your text to hit APCA/WCAG whatever, and your C has 50 L*, your palette is everything from 90 L* to 100 L* and 0 L* to 10 L*.
BTW, would this relatively simple way to determine if the color is dark work?
$luminance = 0.299 * $r + 0.587 * $g + 0.114 * $b;
return $luminance < $threshold;
Where $threshold is 128, I think? IIRC 128 is a common threshold from what I remember, in this case.No it doesn't? The screenshot of the calculator in the blog post very clearly shows that white has a greater contrast according to APCA. (If the negative numbers are confusing, you can also put the colors into a BridgePCA calculator like https://www.color-contrast.dev/?txtColor=FFFFFF&bgColor=317C... to see WCAG-2-style "contrast ratio" metrics computed using APCA.)
The point of APCA is to make the contrast calculation more perceptually accurate, not just lower the threshold.
If you're unlucky enough to be familiar with the math, it is trivial to show it lowers the threshold at luminances, no matter the luminance (widely accepted Y or L*, or APCA's own luminance calc)
Re: the idea I think the point of APCA is to lower contrast threshold - you're entirely correct that this is a side effect of the main goal - to model contrast more accurately.
There is no such thing as non-perceptual contrast, perceptual contrast is a tell stuff is being regurgitated.
We're a bit far afield when we're doing APCA => BCPA => claims actually contrast ratio is 2.4 => look at actual contrast ratio, and its...5.39.
2.4 is supposed to be unreadable, which clearly isn't the case here.
So what's going on?
The wrong text size is being used on the BCPA site, it's being calculated as if it's 12 pt and it's 36 pt in the article.