New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 814121 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocking:
issue 809281



Sign in to add a comment

Desktop PWAs: Title bar foreground color contrast too low

Project Member Reported by mgiuca@chromium.org, Feb 21 2018

Issue description

Chrome Version: 66.0.3344.0
OS: Chrome

What steps will reproduce the problem?
(1) Install an app with theme_color #f16c00 (i.e., the Google Play Music theme colour).
(2) Open the app window.

What is the expected result?
The colour of the title bar buttons is high contrast.

What happens instead?
The colour of the title bar buttons is #5a5a5a. This doesn't contrast that well. See screenshot.

Note: We carefully checked the implementation to match against the material design spec. But we can look again and see if there is a discrepancy with Chrome on Android.

Links:
- Android title bar color calculation: https://codereview.chromium.org/1956803002
- Dark foreground threshold: https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/util/ColorUtils.java?l=19
 
play-music-title-bar.png
3.4 KB View Download

Comment 1 by mgiuca@chromium.org, Mar 19 2018

Blocking: 809281
Cc: calamity@chromium.org mgiuca@chromium.org
Owner: alancutter@chromium.org
Contrast ratio is 2.3:1 (for this particular example).

Santa Tracker has BG #42caee, FG #808080 (CR 2.1:1). We're apparently supposed to have 4.5 minimum for *text*. Maybe icons can be lower, but ~2 seems a bit low.
santa-tracker-title-bar.png
2.9 KB View Download
The colour used by the buttons and origin text comes from:
https://cs.chromium.org/chromium/src/ash/frame/caption_buttons/frame_caption_button.cc?type=cs&q=FrameCaptionButton::GetButtonColor&sq=package:chromium&l=59
This is a simple light/dark check that doesn't have any enforcement of contrast ratios.

The origin text uses views::Label which (given a background colour) ensures the most contrasting colour gets used. For a theme colour of #4285f4 it disagrees with the colour chosen by GetButtonColor(). See screenshot.
Screenshot from 2018-03-20 11-43-09.png
48.5 KB View Download
Created test PWA for the GPM theme colour #f16c00: https://bead-glove.glitch.me/

Comment 4 by mgiuca@chromium.org, Mar 26 2018

Labels: M-67

Comment 5 by hwi@chromium.org, Apr 3 2018

Labels: -Pri-2 Pri-1
Cc: hwi@chromium.org austinknight@chromium.org
The previous test site disappeared somehow.
Created another one with theme colour #F16C00: https://fast-lute.glitch.me/

Compare chromeOS and Clank screenshots.
Android will use white if the contrast ratio is >= 3 otherwise black while chromeOS uses kGoogleGrey100 (#F1F3F4) if the theme colour's luma is less than 128 otherwise kGoogleGrey800 (#3C4043).


chromeOS.png
18.7 KB View Download
clank.png
69.2 KB View Download

Comment 7 by hwi@chromium.org, Apr 5 2018

Cc: mdjones@chromium.org
FYI - +mdjones@ (Clank Eng, who worked on the theme color and contrast)
I think we should make chromeOS consistent with Clank given that web developers have been writing PWAs for mobile so far, they would have been designing their colour palettes against Clank's algorithm.
Screencast of fix.
Video-Fri-Apr-06-2018-10-27-46.webm
2.3 MB View Download
Does this also fix the case where the buttons' color doesn't match the origin's? For example, if the theme color is #4285f4, we get two different colors.

Comment 11 by hwi@chromium.org, Apr 6 2018

alancutter@ - re:c10, in case useful, one example I saw was app.starbucks.com (it shows the same issue as you described in c2). Thanks much for working on this! 
A couple more screenshots.
santa-tracker.png
11.9 KB View Download
#666666 to #bbbbbb.png
25.3 KB View Download
WIP CL at: https://chromium-review.googlesource.com/c/chromium/src/+/999213

#10: Yes, this fixes the mismatched colours for the origin text, see screenshot of #4285f4.

#11: Yep, added screenshot of app.starbucks.com.
#4285f4.png
4.8 KB View Download
starbucks.png
10.6 KB View Download

Comment 14 by hwi@chromium.org, Apr 6 2018

alancutter@, 
what do you think of matching the Clank's foreground color on a light theme:

Light toolbar background colors:
- Foreground: 64% black

Comment 15 by hwi@chromium.org, Apr 6 2018

To add to c14, it helps make the dark foreground blend into the background color. 
#14: Looks like I missed part of the dark foreground colour algorithm on Clank. It should be the theme color blended with 64% black, thanks for catching that!
Updated algorithm to use 64% black theme color for light theme colours. See updated Santatracker screenshot and comparison of #949595 vs #959595 where the contrast ratio of 3 is reached.
santa-tracker.png
22.0 KB View Download
#949595 vs #959595.png
10.2 KB View Download

Comment 18 by hwi@chromium.org, Apr 6 2018

😍 Looks great. Thanks alancutter@!
Status: Started (was: Assigned)
Project Member

Comment 20 by bugdroid1@chromium.org, Apr 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/64a32232a5fbd7fce899abaa9c984ff1b1dd7583

commit 64a32232a5fbd7fce899abaa9c984ff1b1dd7583
Author: Alan Cutter <alancutter@chromium.org>
Date: Thu Apr 12 06:23:27 2018

Use Android style title bar colors for theme colors on chromeOS

This CL updates the way hosted app windows pick title bar colors
while a theme color is set on chromeOS.

This aligns the behaviour with Android, see:
https://codereview.chromium.org/1956803002.

Before:
https://bugs.chromium.org/p/chromium/issues/attachment?aid=329991&signed_aid=3q0FM93vRJrPJV7kMinOTw==&inline=1
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333012&signed_aid=VNXQQhjxyzYYyg36S3nnOQ==&inline=1
https://bugs.chromium.org/p/chromium/issues/attachment?aid=330203&signed_aid=DoC1IRqCuP659D2dMoL1_Q==&inline=1

After:
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333244&signed_aid=J5yNTnY4-7RqGeYu32N8OA==&inline=1
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333245&signed_aid=VOf6afQMQJbCApYu21wmyw==&inline=1
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333257&signed_aid=OJzGQyVnXzCfXF6bZ16TCg==&inline=1
https://bugs.chromium.org/p/chromium/issues/attachment?aid=333258&signed_aid=jygsmXqxXfoPsPZXb_gqfg==&inline=1

Bug:  814121 
Change-Id: I10a2e837d0c8a938072171715119a04c28e4f36a
Reviewed-on: https://chromium-review.googlesource.com/999213
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550045}
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/BUILD.gn
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/caption_buttons/frame_caption_button.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/caption_buttons/frame_caption_button.h
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/caption_buttons/frame_caption_button_container_view.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/caption_buttons/frame_caption_button_container_view.h
[add] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/caption_buttons/frame_caption_button_unittest.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/default_frame_header.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/default_frame_header.h
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/default_frame_header_unittest.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/frame_header_origin_text.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/ash/frame/frame_header_origin_text.h
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/chrome/browser/ui/views/frame/browser_frame_header_ash.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
[modify] https://crrev.com/64a32232a5fbd7fce899abaa9c984ff1b1dd7583/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc

Status: Fixed (was: Started)

Sign in to add a comment