0

Is the following hypothesis true?

For any given color:

{ Hue, Saturation, Lightness_1 }

there exists:

Lightness_2

such that the contrast ratio between:

{ Hue, Saturation, Lightness_1 }

and

{ Hue, Saturation, Lightness_2 }

is at least 4.5.

Bonus question: How could I find such Lightness_2?

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746

1 Answers1

0

If you install the Google Chrome accessibility developer tools extension, then you will see that the accessibility information for a node whose color contrast does not match 4.5:1 will also include information on what color combination is closest that will.

https://chrome.google.com/webstore/detail/accessibility-developer-t/fpkknkljclfencbdbgkenhalefipecmb?hl=en

The algorithm for doing this is included in the GitHub repository: https://github.com/GoogleChrome/accessibility-developer-tools/blob/master/src/js/Color.js#L267

unobf
  • 7,158
  • 1
  • 23
  • 36