Re: [csswg-drafts] [css-color-6] color-contrast() should allow specifying multiple contrast algorithms that need to be satisfied (#7357)

Hi @jpohhhh

This material is so much easier to discuss live with examples, instead of text, but here's a bunch ahead of the call.

First, I do want to mention as _kindly as I possibly can_ that your take on APCA does not reflect the reality or underlying theory. So I want to ask if you've read any of the documentation or white papers? My concern is that I must not have explained things correctly, which is apparently my Achilles heel !! The canonical documentation is at the main repo, and I'll list links in order of preferred reading later in this post.

## _But very quickly_
James, I am wondering where you read or came to the following opinion:
> _...and frankly, the fact APCA neither explicitly models flare, nor does its delta L behavior show it reflecting that white cant get lighter but black can lighter in the presence of flare..._

### _I ask because these statements are categorically false....!_ 😳
- APCA **_EXPLICITLY_** models flare, and does so in a way similar to how DICOM does, and this is documented several places, and is evident in the math.
- APCA also directly addresses the asymmetric nature of polarity, _AND_ models, and more importantly **compensates** for, the _VARIETY_ of psychophysical phenomena that occur near black. Even the simple-pair version of the math and/or the guidelines address these directly, Including and not limited to flare, rod intrusion, halation, and polarity.

I am very concerned that such a line of thought is out there—did you read this somewhere? What prompted this?


## Further Addressing Your Posts Above:

> _APCA as documented for WCAG 3 draft_

Which draft?  I looked at the spreadsheet—but the functions are hidden so I can't examine the math or method....?? It does not look right. See the readme at the main repo, or at the apca-w3 npm page. **_Do not use anything labeled SAPC._**

### One or two little bits:

> _Contrast measures are for a11y, guaranteeing legibility for the population._

**Contrast is important for 100% of sighted users.** Human vision is a spectrum as wide as the human experience, and our vision changes over our lives: we're essentially blind at birth, and it takes 20 years to develop peak contrast sensitivity... and then we hit our 40s, and presbyopia sets in. At 60, it's all down hill from there!

> _how you're handling the ~10% of users with skews in perception of hue and chroma (some can't see it entirely!)_ 

The short answer is that the APCA guidelines are directly following the long established, peer reviewed scientific consensus of modern readability research, especially for low vision, and particularly Dr. Lovie-Kitchin, Bailey, Whittaker, et alia, and also Legge, Chung, etc.....

Okay, we need to define a couple things:

**1) Readability Contrast**—Prime Focus of APCA
    - For the vast majority of text, and particularly for columns of body text, only achromatic luminance contrast is useful or important, especially for low vision.
    - Hue/Chroma are processed in the brain separately, and don't figure into lexical processing (for the most part, see "Stroop tests" for more).
    - **ALL sighted users need ample luminance contrast for readability** at best speed and comprehension.

**2) Discernibility Contrast**—A Different Beast, processed differently in the brain.
    - Here's the problem, colors **are** very helpful for object recognition. Dataviz fits in here of course.
    - It is THESE tasks that those with color insensitive vision need help with, and that help is summarized as:
        - **Do not use color as the sole means of conveying information**

3) **The Term "Contrast":**
    - Like color, contrast is not real. Both color and contrast are **_perceptions_** of the Human Vision System (HVS).
    - Luminance is a photometric _QUANTITY_ of light. It is not "perception".
    - A luminance difference is a photometric distance between the light and dark values.
        - **This is not contrast.**
    - Contrast, the perception, is a psychophysical sensation
    - Contrast is very context dependent, and some of the contextual factors are:
        - Spatial Frequency of the stimuli, meaning font weight, line thickness, size, spacing, edge sharpness....
        - Adaptation: local, field, and ambient (global) adaptation state
        - The stimulus luminance in a multi-way race with the adjacent (local) luminance, and considering the field luminance.
        - **The distance above threshold (JND).**
 
This last point is the most critical to understand, because not only are perceptual lightness estimation power curves curved, but the perception of contrast resulting from the distance of two different lightnesses is ALSO curved, by which I mean the contrast change from threshold to supra-threshold is also very non linear relative to the distance (difference). And the shape of THAT curve is ALSO dependent on spatial frequency.

Take a look at this image:

![Yellow Dots checkers Optical_grey_squares_orange_brown_(opaque)](https://user-images.githubusercontent.com/42009457/178430040-7f41c09c-fbdf-4b39-8136-8210cc34bc1d.png)

The two yellow dots are EXACTLY the same. As far as XYZ or LAB or the sRGB vaules being sent to the monitor are concerned, both yellow dots are identical.

And yet they both look distinctly different. 


The photometric difference between two light or dark "things" **does not define contrast perception**. It is _not_ contrast.

And neither WCAG 2 ratio or ∆L* are uniform to perception. Historically this has not been a problem BECAUSE, in physical PRINT, it is almost always black ink on white paper. And even if not, there was a designer there to lock it in place.

### _Why This Is So Important Today_
The WEB is dynamic content, not locked into place as printed words on paper are, and today there is the desire to have **automatic properties in CSS** and automation for things like auto darkmode or auto high-contrast.

**AUTOMATION of colors is only realistically possible if you have perceptually uniform methods.**

While L* may be more or less uniform to perception of low spatial frequency diffuse surfaces under ideal illumination conditions, I can tell you that L* does not predict lightness perception of high spatial frequency elements (text) on a self illuminated monitor.

I'll fill you in on this this afternoon, but in short:

### Human perception is very literally curves upon curves.

**Now a few things to set the record straight, particularly for anyone reading at home....**

-----
## _RE: APCA_
1. APCA does not use L\*, which is based on Munsell value, which is lightness perception of patches of surface colors while adapted to a viewing environment with a defined ambient illumination.
2. If anything, APCA is closer to Stevens, but more specifically references appearance models including RLab, Hunt, Barten, and CAM02, among others.
3. APCA **_does_** have a mild hue adjustment, and it's part of the "non-standard" linearization, which is also documented.[footnote a] 

## _COLOR VISION INSENSITIVITY_
There is this misunderstanding out on the web, and I am not sure the source, but I do see it a lot in the context of accessibility. I believe it may be in conjunction with the WCAG 2.0 understandings documents. Here are the facts.

1. **It is peer reviewed scientific consensus that individuals with color vision deficiency have standard _or better_ contrast sensitivity and visual function.**
    - Peer reviewed literature: [1][2][3]
    - The one exception is red against black for protan individuals, as they have reduced luminance perception of deep reds.
    - Those with deutan forms are not adversely affected in terms of contrast sensitivity, as the M cone is substantially overlapped by the L cone.
    - In fact deutan/protan show standard **_or better_** visual function _overall_ (hue discrimination notwithstanding).
        - A current theory suggests that the deutan/protan improved acuity is the result of lower neural noise.
    - It is however known that a general loss in contrast sensitivity may cause a loss in color differentiation as a co-morbid affect[4][5], which one might expect due to the lower contrast resolution of the color pathways.

2. It is peer reviewed scientific consensus that achromatic luminance contrast is what is most important for readability, and also for fine details.[6][7]
    - Hue/chroma do not enter into readability and high spatial frequency stimuli, and especially for low vision.
        - Hue chroma are a third the resolution and a third the contrast strength of the luminance channel.
    - The exception is for the few instances where hue is a blocking condition. Examples:
        - Red against Black
            - Red too low of a luminance for small text, even for normal vision.
            - But for the protan it is essentially unreadable,[8] and
            - With some of the newer technology UHD monitors, the red could be invisible to the protan. 
        - Red against Blue
            - For most vision types, red against blue can result in chromatic aberration, with the symptoms of "shimmer" or "chromostereopsis".[9]
        
-----
## _APCA DOCUMENTATION_
I've been working hard to clear up these misconceptions, so I've been trying to organize the documentation is a logical manner. The links listed in this section are placed in an order that starts with the plain language overview before getting into the minutiae. 

### Easy Start ↓
- [Why APCA](https://git.apcacontrast.com/documentation/WhyAPCA) The brief overview, starts with why WCAG2 has issues, discusses the challenges of readability contrast, and then introduces the solution.
- [Regarding Exponents](https://git.apcacontrast.com/documentation/regardingexponents) The brief discussion of the use of the exponents in APCA, including why 2.4 is NOT a mistake, but an intentional pre-shaping stage.
- [Main ReadMe Doc](https://git.apcacontrast.com/documentation/README) In the main repo documentation folder, this includes a code walkthrough, LaTeX math, the optional visual font lookups, and links to more stuff.

### Visual Comparisons and Related Articles ↓
- [Orange You Wondering About Contrast?](https://gist.github.com/Myndex/1dadb6dcac596f1cd7a5686a076f697f) Part I of three on the APCA and why perceptually uniform lightness contrast is important.
- [Better reading on the web](https://uxdesign.cc/better-reading-on-the-web-c943c4cfc91a) A discussion of automated testing and real world examples of contrast metrics.
- [Please Stop Using Grey Text](https://tangledweb.xyz/please-stop-using-grey-text-3d3e71acfca8) Discusses issues with WCAG2, with examples of dark mode, etc.
- [WCAG2 vs APCA](https://github.com/Myndex/SAPC-APCA/discussions/30#discussion-3678164) A set of direct head to head comparisons, including illustrative graphs and apples to apples comparisons studies.
- [A Contrast of Contrasts](https://tangledweb.xyz/a-contrast-of-contrasts-3ddda0f4061b) Brief article on perceptual contrast.

### The Official Demo Tool  ↓
- [The APCA Demo Tool](https://www.myndex.com/APCA/) This is the canonical example tool for the current APCA.

### Deeper Technical & Theory  ↓
These are all a bit rough or in draft form, and are much deeper dives into the underlying theories.
- [Experiment CE17, ](https://www.myndex.com/WEB/WCAG_CE17polarity) a short early white paper on the concept.
- [The white paper in progress](https://www.w3.org/WAI/GL/task-forces/silver/wiki/Visual_Contrast_of_Text_Subgroup/Whitepaper) regarding the underlying theories of readability contrast, with a partial bibliography.
- [Practical Contrast Guidelines](https://github.com/Myndex/SAPC-APCA/discussions/39#discussion-3757102) work in progress in defining use case guidelines and how they inform contrast design decisions, includes more theory and referenced research in readability.

-----


That's it for this post, thank you for reading.

—_Andy_

----
----
### _Academic Peer Reviewed Published Science as referenced above_
[1 • Spatial visual function in anomalous trichromats: Is less more?](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0209662)
[2 • Eye-Tracker Analysis of the Contrast Sensitivity of Anomalous and Normal Trichromats: A Loglinear Examination with Landolt-C Figures](https://www.mdpi.com/2076-3417/11/7/3200/htm#)
[3 • Contrast sensitivity of patients with congenital color vision deficiency](https://metrovision.fr/2019/2019_Ilhan_Contrast_sensitivity_in_congenital_color_deficiency.pdf)
[4 • Evaluation of contrast sensitivity and color vision in lead and zinc mine workers](https://pdfs.semanticscholar.org/c44b/3e2ca75ce8247bbb2eb6126db99542f366b3.pdf)
[5 • Effects of Contrast Sensitivity on Colour Vision Testing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5762144/)
[6 • Effects of luminance contrast and character size on reading speed](https://www.sciencedirect.com/science/article/pii/S0042698919302111)
[7 • Luminance and chromatic contrast effects on reading and object recognition in low vision](https://pubmed.ncbi.nlm.nih.gov/8594527/)

### Non-Academic General Audience
[8 • What’s Red & Black & Also Not Read?](https://tangledweb.xyz/whats-red-black-also-not-read-573b9c0a97ed)
[9 • Chromostereopsis](https://en.wikipedia.org/wiki/Chromostereopsis)

_Footnotes_       
(a) Nevertheless, I am removing non-standard linearization, and using the standard(s) per CSS 4/5, and handling protan compensation with a separate protan color module shortly...
- I would have used ^2.5 if I had realized the massive misunderstandings that would happen by using ^2.4 without the offset (i.e. the piecewise), even though I documented it...
    - Related, it's been brought to my attention my documentation is hard to parse, and I am actively working to resolve that. 


-- 
GitHub Notification of comment by Myndex
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7357#issuecomment-1181405373 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 12 July 2022 07:17:15 UTC