Nearest valid color suggestion function #21
TheJaredWilcurt
started this conversation in
Ideas
Replies: 1 comment
-
|
Thinking of this more, since APCA is multi-dimensional, the return could just be a string ( {
nearestInHue: '#00D18B',
nearestInLuma: '#00D18B',
nearestInFontSize: 36,
nearstInFontWeight: null
}That would be more reflective of the spirit of APCA. Where you could choose to just change the font size or weight to retain the same colors, but make them meet your desired Lc. Or an array of recommendations that would satisfy the results: [
{
foreground: '#00D18B',
size: 36,
weight: 600
},
{
foreground: '#000000',
size: 14,
weight: 500
},
// etc
] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
With WCAG, I can use tools to validate the contrast ratio of two colors, and if they have too low of contrast I can use tools to find what the closest color is to either of them that would give you the desired contrast.
Example:
Notice how the suggested colors meet the minimum contrast ratio, and are also very similar to the original colors. If I change either the text or background to one of these suggestions, it now passes the
4.5contrast ratio requirement.I want that, but for APCA. Currently the closest option I've found is
reverseAPCA, but it has problems:falseinstead of a colorHere is a proposed API:
Beta Was this translation helpful? Give feedback.
All reactions