Don't use InvertColor() to try and guarantee contrast.

In particular, inverting a light color may give you an even lighter color, e.g.
#8070ff (contrast ratio against white 3.69) inverts to #7f8f00 (contrast ratio
against white 3.6).  There's a function in color_utils called GetReadableColor()
that tries to lightness-invert the color, but that turns out not to work well
either, e.g. HSL 60,100%,36% (contrast ratio against white 2.12)
lightness-inverts to HSL 60,100%,64% (contrast ratio against white 1.06).

Instead use GetColorWithMinimumContrast().  This will reduce the ontrast of some
cases compared to current behavior, but it will also guarantee no cases are
below the minimum.

Bug: 659451
Change-Id: I09b5850e0ba3b76ca6e004c9320131ac175cbe43
Reviewed-on: https://chromium-review.googlesource.com/c/1406241
Reviewed-by: Kristi Park <kristipark@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622194}
1 file changed