Reverse lookup table? #27
-
@Myndex this table is very helpful if you come to the problem with the question of "What font sizes and weights can I use for this foreground/background color pair?" However, it's not very clear how an inverse of this would be resolved -- "What contrast value do I need to meet for text of font-weight X and font size Y on background color Z"? On top of that, I see there are also "Levels"/"Scores", so it would be nice to inject that variable into the same question --* "...and for score level 5"*. Is that logic, or the table of requirements already somewhere in this codebase? The text version of the lookup table isn't much more helpful, since it doesn't specify score level ranges. Here's an example use case for what I'm trying to accomplish: function APCAContrastValue(fontSize, fontWeight, backgroundColor, scoreLevel) {
// look up table?
return contrastValue;
} For example: var desiredContrastValue = APCAContrastValue('14px', 400, 0xf5f5f5, 5);
// returns 100 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hey Nate, to answer:
That is shown on the manual lookup table lower on the page. The background color is irrelevant, in that any APCA contrast value is the same. Or perhaps I should say, the SAPC methodology predicts a perceived contrast relative to either the text or background color, so if a given font needs contrast 60, it does not matter if the BG if f5f5f5 or ccc — contrast 60 will mean a text color of 818181 or 4c4c4c respectively. At https://www.myndex.com/SAPC/ go into research mode and select "constant contrast" for an interactive demo. SAPCinverseIf you mean a tool that you can enter a BG color and a text size/weight, that is possible (and planned). In the JS file at https://www.myndex.com/SAPC/JS/DEV98G_SAPCsRGB.js Is a function called SAPCinverse() that will return a color based on a BG color and a target contrast. Also, the index file https://www.myndex.com/SAPC/ (and also /APCA/) includes lookup tables that are useful for interpolation. The manual lookup table, lower on the page, indicates the contrast needed for a particular font size and weight, and I think that is what you are looking for? As for scoring levels, there is an obsolete set of tables that were part of the discussion here: Note these are OBSOLETE relative to the current constants, they have not been updated as the way conformance and score levels is being handled is not clear at the moment. For the time being, focus on "Score 4" and the current table displayed lower on the page at https://www.myndex.com/SAPC/ As this is all still a work in progress, some of these finer aspects are still being worked out. |
Beta Was this translation helpful? Give feedback.
-
Hey Alex @alex-page Sorry about this, I was trying to simplify it and I think I made it more complicated.
We are getting to a point where I am thinking a group of users and myself and some others of the team just talk about these kinds of things on a zoom call — I've been pushing this project nearly three years, so I might be so very familiar with something I might not realize on first encounter it is challenging. As for scoring, that is an early concept with WCAG_3 — the conformance model is still evolving. I created a new thread #39 which has some more recent work and lots of cites, references, infographics... Let me know if that answers you? Thank you! Andy |
Beta Was this translation helpful? Give feedback.
Hey Alex @alex-page
Sorry about this, I was trying to simplify it and I think I made it more complicated.
I am in the process of separating tables per use case.
The "general" guidelines are not definitive, they are "soft"
We are getting to a point where I am thinking a group of users and myself and some others of the team just talk about these kinds of things on a zoom call — I've been pushing this project nearly three years, so I might be so very familiar with something I might not realize on first encounter it is challenging.
As for scoring, that is an early concept with WCAG_3 — the conformance model is still evolving.
I created a new thread #39 which has some more recent work an…