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

APCA constants - consistent naming #645

Open
svgeesus opened this issue Jun 20, 2022 · 3 comments
Open

APCA constants - consistent naming #645

svgeesus opened this issue Jun 20, 2022 · 3 comments
Labels
bug Something isn't working with docs migration: guidelines Issues that apply to guidelines Subgroup: Visual Contrast Directly Related to Visual Contrast of Text SubGroup

Comments

@svgeesus
Copy link

(I would raise an issue on the constants in WCAG 3, but they haven't been added yet until #570 is merged)

The problem

The Current APCA Constants ( 0.0.98G - W3 last changed Feb 15, 2021 ) lists constants, but gives no equations.

The APCA Base Math (sRGB) lists constants and equations, but the names used are not the same and the set of constants is not exactly equivalent.

When implementing, I mainly used the value of the constants to check equivalence (which kind of defeats the point of named constants) but clearly this fails if two constants have the same value and the mapping is not immediately obvious.

Correspondences

The correspondences seem to be:

Constant Value Base Math
exponents
mainTRC2.4no name
normBG0.56no name
normTXT0.57no name
revTXT0.62no name
revBG0.65no name
colorSpace
sRco0.2126729no name
sGco0.7151522no name
sBco0.0721750no name
clamp
blkThrs0.022Bthresh
blkClmp1.414Bexp
loClip0.1Pout
deltaYmin0.0005Pin
scalers
scaleBoW1.14Rscale
loBoWoffset0.027Woffset
scaleWoB1.14Rscale
loWoBoffset0.027Woffset

Suggested fixes

  1. Give the un-named constants names
  2. Change Bexp to Bclmp, or otherwise make the correspondence obvious
  3. Either change Pout to something like Cliplow, or change loClip to Pout
  4. Either change Pin to something like deltaYmin, or change deltaYmin to Pin
  5. Either decide that the WoB and BoW scalers and offsets might be different, and thus mint new names for use in base math (like BoWscale, WoBscale, BoWoffset, WoBoffset )or decide that they will be the same going forward and mint just two new names for the constants, like scale and offset.

Also

In addition, please be aware that the chosen 5-digit chromaticity values for D65 differ slightly from the 4-digit ones used in CSS Color 4 (the latter being changed several times, although we finally went for the 4-digit ones throughout for consistency with the defining color space specifications) and also that the matrix coefficients for RGB to Y also differ from both CSS and the sRGB specification. The CSS ones were calculated from first principles and agree with the sRGB standard ones when rounded to 8 significant figures.

@svgeesus svgeesus added bug Something isn't working with docs Subgroup: Visual Contrast Directly Related to Visual Contrast of Text SubGroup labels Jun 20, 2022
@Myndex
Copy link
Member

Myndex commented Jun 23, 2022

If I understand it, just the consistency between the code and the LaTeX svg? I probably should just lose the LaTeX as it's probably more confusing than helpful.

The constants in the LaTeX are intentionally different, as it originated at a time when the code was changing rapidly including variable names etc. The LaTeX does not really serve a purpose anymore as I think of it. It would probably be best at this point to create a pseudocode, or just show the basic JS.

Regarding PR #213 or #570 (or the #568 which I closed to make #570, trying to figure out why they are not being merged, and not getting any answers) Most recently I was told that that entire page would be deleted so that it was no longer something linked to, which is probably ideal.

Regarding the D65 and the chromaticity coefficients: I am using the BruceLindbloom ones also intentionally, as there was some experimentation in the past regarding the coefficients relating to certain impairments, and I wanted it to be easily recognizable that they were different.

But as discussed in other threads, those will change as I align things to the CSS 4 values for all of the standard "CIE/IEC" stuff.

@svgeesus
Copy link
Author

The constants in the LaTeX are intentionally different, as it originated at a time when the code was changing rapidly including variable names etc. The LaTeX does not really serve a purpose anymore as I think of it. It would probably be best at this point to create a pseudocode, or just show the basic JS.

As long as the equations are clearly documented such that they can be independently implemented.

@Myndex
Copy link
Member

Myndex commented Jun 28, 2022

I am working on organizing and cleaning up documentation, and streamlining it to improve access and understanding.

@rachaelbradley rachaelbradley added the migration: guidelines Issues that apply to guidelines label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working with docs migration: guidelines Issues that apply to guidelines Subgroup: Visual Contrast Directly Related to Visual Contrast of Text SubGroup
Projects
None yet
Development

No branches or pull requests

4 participants
@svgeesus @rachaelbradley @Myndex and others