color.js icon indicating copy to clipboard operation
color.js copied to clipboard

Add `BPCA` to contrast algo's?

Open argyleink opened this issue 3 years ago • 8 comments

https://www.myndex.com/BPCA/

"The Bridge PCA tool corrects some of the worst failings of the WCAG 2 math and methods, such as calculating contrast for "Dark Mode". "

argyleink avatar Sep 07 '22 22:09 argyleink

Sure, why not

LeaVerou avatar Sep 08 '22 08:09 LeaVerou

I see the BPCA tool is "forked from https://github.com/LeaVerou/contrast-ratio".

Looking for the actual normative definition of the math.

svgeesus avatar Sep 13 '22 14:09 svgeesus

OK, found it or at least, the constants but not the algorithm.

svgeesus avatar Sep 13 '22 14:09 svgeesus

This looks like it

argyleink avatar Sep 13 '22 15:09 argyleink

Hi Chris @svgeesus and Adam @argyleink

Bridge PCA has an added scaling over part of the range to fail the same colors that WCAG 2 incorrectly fails, but importantly, fails many color pairs that WCAG 2 incorrectly passes. As such, it is stricter that WCAG 2 but also a bit less flexible than APCA. The flexibility is given up in order to be backwards compatible to WCAG 2.

It has its own repo:

https://github.com/Myndex/bridge-pca

The function BPCAcontrast(txtY,bgY) works just like APCA, returning a polarity sensitive value (-108 to +106)

The function bridgeRatio(Lc,txtY,bgY) takes the BPCA Lc value, and converts it to a WCAG 2 style ratio, and as such is a "drop in replacement" for WCAG 2 math, usable with the WCAG 2 contrast SCs.

Please let me know if you have any questions here...

Myndex avatar Sep 20 '22 09:09 Myndex

Which one should we report as being BPCA, I assume the one scaled to WCAG2 values?

svgeesus avatar Oct 05 '22 14:10 svgeesus

Hi Chris @svgeesus

Which one should we report as being BPCA, I assume the one scaled to WCAG2 values?

Okay, so on the BPCA tool, there are two outputs. One, an Lc value, and the other, a ratio.

They are both scaled in such a way that backwards compatibility to WCAG 2 is maintained.

But, the Lc value is for use with the "BPCA enhanced" guidelines, and the ratio is intended as a "drop in replacement" for the WCAG 2 SCs such as 1.4.3 and so on.

Side Note:

BridgePCA was developed only to address some aspersions from a small group of trolls. It maintains backwards compatibility at the loss of some useful flexibility. It's a way to "force fit" WCAG_2 guidelines into something less harmful, but because WCAG_2 ignores spatial frequency as a primary driver of contrast, Bridge PCA is restricted from relaxing contrast on low-spatial frequency elements, which is specifically needed yet missing in WCAG 2.

For instance, WCAG_2 SC 1.4.11 is not supported by actual science, only some self-referential cites that arguably have no place in a standards document. 1.4.11 makes some logical leaps and ignores the primary drivers of contrast perception.

Myndex avatar Oct 05 '22 16:10 Myndex

Just making a note of some soon to release changes:

  1. BPCA is going to become non-polar.
    • WCAG 2.x is not polarity aware, and so BridgePCA as a drop in replacement should not be either.
    • Switching to non-polar mode (essentially light mode only) actually eliminates most of the backwards compatibility issues in a natural way.
    • The one issue with non-polar mode is that negates the maximum contrast guideline, which only applies to negative screen contrast (Lc -90).

Myndex avatar Sep 18 '23 18:09 Myndex