New issue
Advanced search Search tips

Issue 866145 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Determine final design for color_utils::GetColorWithMinimumContrast

Project Member Reported by bsep@chromium.org, Jul 20

Issue description

For  bug 856812  I landed a preliminary API that lets a UI surface ask for a readable color given foreground and background colors. There are a few problems with my solution:
* The implementation does a binary search for the correct color. Hypothetically we could directly calculate the required luminance for minimum contrast and use that to derive a blend of the foreground color. However, the math is tricky.
* Callers often have to do something like: "foreground = IsDark(background) ? white : black" before calling GetColorWithMinimumContrast. Ideally we would clean that up, but we can't simply select the starting foreground color with the best contrast. Most surfaces have multiple colors that all need to be "dark themed" or "light themed" together and a naive solution could cause them to get out of sync.
* The implementation has to guess which way to blend the foreground color. If the caller gives a background a foreground on the same side of the spectrum (both light or both dark), it's not clear whether we should blend to the extreme of that spectrum (to preserve being on the same side of the spectrum) or blend the opposite way (to guarantee a good contrast).
 
Labels: Hotlist-DesktopUIToolingRequired Hotlist-DesktopUIChecked
***UI Mass Triage ***
Cc: -pkasting@chromium.org
Owner: pkasting@chromium.org
Status: Started (was: Available)

Sign in to add a comment