Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme: implement and adopt service for handling ColorSchemes (dark, light, hc) #105715

Closed
bpasero opened this issue Aug 31, 2020 · 4 comments
Closed
Assignees
Labels
accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues debt Code quality issues on-testplan themes Color theme issues

Comments

@bpasero
Copy link
Member

bpasero commented Aug 31, 2020

The idea is to introduce central methods in IHostService to:

  • figure out the current color scheme
  • register to events when color schemes change

Idea for ColorScheme is an enum of:

  • DEFAULT
  • DARK
  • HIGHT_CONTRAST

Implementation depends on the runtime:

  • Electron: nativeTheme allows to figure out high contrast and dark scheme preference
  • Browser: we can currently only detect preference for dark theme via a CSS check
@bpasero bpasero added debt Code quality issues themes Color theme issues labels Aug 31, 2020
@bpasero bpasero added this to the September 2020 milestone Aug 31, 2020
@bpasero
Copy link
Member Author

bpasero commented Aug 31, 2020

@aeschli please check #105716 for a first cut of support in the IHostService. Unfortunately I was not able to move the listener into IThemeService due to some cyclic dependencies, so maybe we have to put this into a separate workbench contribution that gets instantiated in the right lifecycle phase.

Things to do:

  • move into theme component
  • wire in the listener to dark theme changes in native environment
  • figure out if we can support color scheme changes and HC detection logic somehow into the browser

@bpasero bpasero added the accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues label Aug 31, 2020
@aeschli
Copy link
Contributor

aeschli commented Sep 9, 2020

We now have a separate IHostColorSchemeService with a browser and electron variant.

The browser uses the experimental force-colors to detect hc: https://drafts.csswg.org/css-color-adjust-1/#forced-colors-mode
Forced colors is already enabled in Edge, and can be enabled in Chrome.
We also now set the rule forced-color-adjust: none so that we stay in control of all the colors.

@aeschli aeschli closed this as completed Sep 9, 2020
@bpasero bpasero added the verification-needed Verification of issue is requested label Sep 9, 2020
@bpasero
Copy link
Member Author

bpasero commented Sep 9, 2020

I suggest to either put this on test plan or verify.

@aeschli
Copy link
Contributor

aeschli commented Sep 10, 2020

I'll put this on the test plan, there's enough to test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues debt Code quality issues on-testplan themes Color theme issues
Projects
None yet
Development

No branches or pull requests

2 participants