Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants