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

Add a dark mode #4017

Merged
merged 15 commits into from
Dec 4, 2019
Merged

Add a dark mode #4017

merged 15 commits into from
Dec 4, 2019

Conversation

richard-cox
Copy link
Contributor

@richard-cox richard-cox commented Nov 8, 2019

  • Allow user to toggle between light and dark modes
  • Conditionally show 'OS' mode which honours prefers-color-scheme
    • OS dark mode only triggered on my desktop with FF and about:config ui.systemUsesDarkTheme integer 1
    • Should consider if this is well supported enough to outweigh confusion

# Conflicts:
#	src/frontend/packages/core/sass/_all-theme.scss
#	src/frontend/packages/store/src/reducers/dashboard-reducer.ts
@nwmac
Copy link
Contributor

nwmac commented Dec 3, 2019

window.getAllSelectors = function() {
var ret = [];
for(var i = 0; i < document.styleSheets.length; i++) {
var rules = document.styleSheets[i].rules || document.styleSheets[i].cssRules;
for(var x in rules) {
if(typeof rules[x].selectorText == 'string') ret.push(rules[x].selectorText);
}
}
return ret;
}

window.haselector = function(selector) {
var selectors = getAllSelectors();
for(var i = 0; i < selectors.length; i++) {
if(selectors[i] == selector) return true;
}
return false;
}

window.haselector('.dark-theme-supported');

Copy link
Contributor

@nwmac nwmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Richard to look at disabling dark theme support if indicated by theme customizer

- wired in dark-theme-supported to theme options
- removed test line from custom.scss
Copy link
Contributor

@nwmac nwmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nwmac nwmac merged commit cb91516 into master Dec 4, 2019
@nwmac nwmac deleted the dark-theme branch December 4, 2019 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants