Bug 193507 - Web Inspector: Use system accent color throughout UI
Summary: Web Inspector: Use system accent color throughout UI
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks: 195103
  Show dependency treegraph
 
Reported: 2019-01-16 13:36 PST by Matt Baker
Modified: 2019-02-27 10:08 PST (History)
8 users (show)

See Also:


Attachments
Patch (21.78 KB, patch)
2019-01-16 13:44 PST, Matt Baker
no flags Details | Formatted Diff | Diff
[Image] Blue (default) (763.19 KB, image/png)
2019-01-16 13:48 PST, Matt Baker
no flags Details
[Image] Purple (763.44 KB, image/png)
2019-01-16 13:49 PST, Matt Baker
no flags Details
[Image] Pink (763.67 KB, image/png)
2019-01-16 13:49 PST, Matt Baker
no flags Details
[Image] Orange (763.93 KB, image/png)
2019-01-16 13:49 PST, Matt Baker
no flags Details
[Image] Breakpoints - green (693.01 KB, image/png)
2019-01-16 13:50 PST, Matt Baker
no flags Details
[Image] Light mode - blue of selected tab is too dark (38.33 KB, image/png)
2019-01-16 15:15 PST, Nikita Vasilyev
no flags Details
[Image] Accent color comparisons (141.76 KB, image/png)
2019-01-16 15:16 PST, Matt Baker
no flags Details
[Image] Bug — Network tab (54.41 KB, image/png)
2019-01-16 15:18 PST, Nikita Vasilyev
no flags Details
Patch (22.71 KB, patch)
2019-02-17 17:28 PST, Matt Baker
no flags Details | Formatted Diff | Diff
Patch (38.96 KB, patch)
2019-02-25 17:43 PST, Matt Baker
no flags Details | Formatted Diff | Diff
Patch (41.19 KB, patch)
2019-02-25 20:25 PST, Matt Baker
no flags Details | Formatted Diff | Diff
[Image] Light mode - default accent (745.34 KB, image/png)
2019-02-25 20:44 PST, Matt Baker
no flags Details
[Image] Dark mode - green accent (754.04 KB, image/png)
2019-02-25 20:45 PST, Matt Baker
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.53 MB, application/zip)
2019-02-25 22:26 PST, EWS Watchlist
no flags Details
[Image] Inspect Element button, Dark Mode, Blue accent (13.31 KB, image/png)
2019-02-26 16:33 PST, Nikita Vasilyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2019-01-16 13:36:49 PST
Summary:
Use system accent color throughout UI. https://webkit.org/b/186609 exposed more semantic system colors to CSS. Using the system accent and highlight colors for some Inspector UI will provide a more seamless experience on macOS Mojave:

System accent color (-apple-system-control-accent):
- Breakpoints
- ScopeBar items
- NavigationBar button glyphs and radio buttons

System highlight color (-apple-system-selected-content-background):
- Table/TreeOutline selection
Comment 1 Radar WebKit Bug Importer 2019-01-16 13:37:28 PST
<rdar://problem/47327971>
Comment 2 Matt Baker 2019-01-16 13:44:17 PST
Created attachment 359300 [details]
Patch
Comment 3 Matt Baker 2019-01-16 13:48:56 PST
Created attachment 359303 [details]
[Image] Blue (default)
Comment 4 Matt Baker 2019-01-16 13:49:17 PST
Created attachment 359304 [details]
[Image] Purple
Comment 5 Matt Baker 2019-01-16 13:49:34 PST
Created attachment 359305 [details]
[Image] Pink
Comment 6 Matt Baker 2019-01-16 13:49:50 PST
Created attachment 359306 [details]
[Image] Orange
Comment 7 Matt Baker 2019-01-16 13:50:10 PST
Created attachment 359307 [details]
[Image] Breakpoints - green
Comment 8 BJ Burg 2019-01-16 14:34:53 PST
Comment on attachment 359300 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=359300&action=review

I think we need to extract the -apple- values into variables so that other ports can customize them. Other than that, this patch looks good to me. Nikita, please take a look as well.

> Source/WebInspectorUI/ChangeLog:18
> +        to pick up the system accent color.

Yay!

> Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css:33
> +    filter: grayscale();

Nice idea.

> Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js:164
> +        this.status.classList.toggle(WI.BreakpointTreeElement.StatusImageResolvedStyleClassName, this._breakpoint.resolved && WI.debuggerManager.breakpointsEnabled);

Nice cleanup.

> Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css:65
> +    background-color: -apple-system-unemphasized-selected-content-background;

o_o
Comment 9 Matt Baker 2019-01-16 14:47:43 PST
(In reply to Brian Burg from comment #8)
> Comment on attachment 359300 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=359300&action=review
> 
> I think we need to extract the -apple- values into variables so that other
> ports can customize them. Other than that, this patch looks good to me.
> Nikita, please take a look as well.

These are defined in CSSValueKeywords.in behind a guard,

#if defined(WTF_PLATFORM_MAC) && WTF_PLATFORM_MAC

so accommodations will need to be made.
Comment 10 Nikita Vasilyev 2019-01-16 15:09:48 PST
Comment on attachment 359300 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=359300&action=review

> Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.css:64
> +    filter: brightness(0.8);

This makes the default blue (light mode, blue highlight color, blue accent color) look too dark.
Comment 11 Matt Baker 2019-01-16 15:14:14 PST
I agree, I'll need to tweak the colors a little.
Comment 12 Nikita Vasilyev 2019-01-16 15:15:05 PST
Created attachment 359320 [details]
[Image] Light mode - blue of selected tab is too dark

The blue color of the selected tab is too dark.

Ideally, we'd want to make it darker only for certain accent colors (e.g. yellow).
I don't know how to do this.

If we can't, we should decide what do we care the most: matching system appearance or making custom accent colors more readable. I'm leaning towards the former.
Comment 13 Matt Baker 2019-01-16 15:16:19 PST
Created attachment 359322 [details]
[Image] Accent color comparisons

In general the light mode colors look too dark, and the dark mode selected and hover colors are too similar.
Comment 14 Nikita Vasilyev 2019-01-16 15:18:42 PST
Created attachment 359323 [details]
[Image] Bug — Network tab
Comment 15 Matt Baker 2019-01-22 12:23:50 PST
I agree with Brian that we need to break out the -apple-system- values. The approach I'm taking is to have a set of variables that parallel the system ones, that are initialized to the hardcoded values we've been using. Then on ports that support it (just Mojave for now), we override then.

I wanted to do something like this in Variables.css:

:root {
    --system-control-accent: hsl(212, 92%, 54%);
    ....
}

body:matches(.mojave) {
    --system-control-accent: -apple-system-control-accent;
    ...
}

:root {
    --glyph-color: var(--system-control-accent);
    ...
}

But of course this doesn't work; the Mojave override occurs at the body level, which has no effect on the variables scoped to the document (:root). I think this approach will require declaring all custom CSS properties at the body level rather than :root.

Any thoughts? Alternative approaches?
Comment 16 Joseph Pecoraro 2019-01-22 12:56:53 PST
(In reply to Matt Baker from comment #15)
> I agree with Brian that we need to break out the -apple-system- values. The
> approach I'm taking is to have a set of variables that parallel the system
> ones, that are initialized to the hardcoded values we've been using. Then on
> ports that support it (just Mojave for now), we override then.
> 
> I wanted to do something like this in Variables.css:
> 
> :root {
>     --system-control-accent: hsl(212, 92%, 54%);
>     ....
> }
> 
> body:matches(.mojave) {
>     --system-control-accent: -apple-system-control-accent;
>     ...
> }
> 
> :root {
>     --glyph-color: var(--system-control-accent);
>     ...
> }
> 
> But of course this doesn't work; the Mojave override occurs at the body
> level, which has no effect on the variables scoped to the document (:root).
> I think this approach will require declaring all custom CSS properties at
> the body level rather than :root.
> 
> Any thoughts? Alternative approaches?

Why not just:

    :root {
        --glyph-color: hsl(212, 92%, 54%);
    }

    body:matches(.mojave) {
        --glyph-color: -apple-system-control-accent;
    }
Comment 17 Matt Baker 2019-02-17 17:28:21 PST
Created attachment 362263 [details]
Patch
Comment 18 Matt Baker 2019-02-17 17:39:02 PST
(In reply to Matt Baker from comment #17)
> Created attachment 362263 [details]
> Patch

Getting pretty close. Still need to tweak a couple of things. ScopeBar/Radio button backgrounds for the inactive-window case are tricky.
Comment 19 Timothy Hatcher 2019-02-19 10:17:36 PST
I think we should use the accent colors directly whenever possible. That way we can get changes in the system for free and always match.
Comment 20 Timothy Hatcher 2019-02-19 10:28:03 PST
Comment on attachment 362263 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=362263&action=review

> Source/WebInspectorUI/UserInterface/Views/Variables.css:173
> +body:matches(.mojave) {

This will need updated every year when we have new systems. You should invert this can make it something like: body.mac-platform:not(.sierra, .high-sierra)

Also you don't need to use :matches(.classname), since body.classname is the same thing. Using :matches() is for more complex selectors to avoid duplication. See: https://css-tricks.com/almanac/selectors/m/matches/
Comment 21 Timothy Hatcher 2019-02-19 10:31:51 PST
Comment on attachment 362263 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=362263&action=review

>> Source/WebInspectorUI/UserInterface/Views/Variables.css:173
>> +body:matches(.mojave) {
> 
> This will need updated every year when we have new systems. You should invert this can make it something like: body.mac-platform:not(.sierra, .high-sierra)
> 
> Also you don't need to use :matches(.classname), since body.classname is the same thing. Using :matches() is for more complex selectors to avoid duplication. See: https://css-tricks.com/almanac/selectors/m/matches/

Actually that should be: body.mac-platform:not(.sierra):not(.high-sierra), since :not() is not like :matches().
Comment 22 Matt Baker 2019-02-25 17:43:06 PST
Created attachment 362947 [details]
Patch
Comment 23 Matt Baker 2019-02-25 20:25:37 PST
Created attachment 362954 [details]
Patch
Comment 24 Matt Baker 2019-02-25 20:30:51 PST
Most recent changes:

1) Added system accent to
   - Console prompt ">"
   - Inline widgets (spring/curve and variable)
   - Rendering Frames timeline selected frame marker
   - DOM breakpoints

2) Radio/scope button background color is no longer darkened.
3) Pressed (:active) radio/scope button is now slightly less dark.
Comment 25 Matt Baker 2019-02-25 20:44:55 PST
Created attachment 362956 [details]
[Image] Light mode - default accent
Comment 26 Matt Baker 2019-02-25 20:45:25 PST
Created attachment 362957 [details]
[Image] Dark mode - green accent
Comment 27 EWS Watchlist 2019-02-25 22:26:30 PST
Comment on attachment 362954 [details]
Patch

Attachment 362954 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/11285357

New failing tests:
imported/w3c/web-platform-tests/webrtc/simplecall-no-ssrcs.https.html
Comment 28 EWS Watchlist 2019-02-25 22:26:34 PST
Created attachment 362963 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 29 Matt Baker 2019-02-26 13:36:41 PST
(In reply to Build Bot from comment #28)
> Created attachment 362963 [details]
> Archive of layout-test-results from ews125 for ios-simulator-wk2
> 
> The attached test failures were seen while running run-webkit-tests on the
> ios-sim-ews.
> Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6

Test failures are unrelated.
Comment 30 Nikita Vasilyev 2019-02-26 16:31:51 PST
I think this is good to land!

In the follow ups we should address:
— Selected console messages should use the selected accent/highlight color. We may have to disable syntax highlighting for selected messages — to be determined.
— In Dark Mode with the default accent color, our icon glyphs are too dark. The active glyph of Inspect Element is particularly bad.
Comment 31 Nikita Vasilyev 2019-02-26 16:33:15 PST
Created attachment 363035 [details]
[Image] Inspect Element button, Dark Mode, Blue accent
Comment 32 Nikita Vasilyev 2019-02-26 16:38:28 PST
Comment on attachment 362954 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=362954&action=review

> Source/WebInspectorUI/ChangeLog:96
> +        Use system accent color for selection and hover styles. Since it isn't
> +        yet possible to derive new colors from the accent color in CSS, fake it
> +        with a ::before pseudo-element that can have have `filter` or `opacity`
> +        effects applied to it without altering the button text color.

It's possible to derive accent colors with getComputedStyle, adjust them with JS, and then store them as CSS variables.
I think it's worth exploring as a follow-up.
Comment 33 Matt Baker 2019-02-26 17:02:08 PST
(In reply to Nikita Vasilyev from comment #31)
> Created attachment 363035 [details]
> [Image] Inspect Element button, Dark Mode, Blue accent

We got pretty close to matching the equivalent UI used for Xcode's docking buttons by adjusting the accent color with brightness/saturate filters. It's a little hacky, and I'll need to confirm it works for all the system accents in both light/dark mode.

Will try this in a follow up.
Comment 34 WebKit Commit Bot 2019-02-26 17:28:08 PST
Comment on attachment 362954 [details]
Patch

Clearing flags on attachment: 362954

Committed r242118: <https://trac.webkit.org/changeset/242118>
Comment 35 WebKit Commit Bot 2019-02-26 17:28:09 PST
All reviewed patches have been landed.  Closing bug.