Compare commits

...

2 Commits

Author SHA1 Message Date
0ead7215ff 1.0.81 2020-12-07 03:47:39 +00:00
286bb0887a fix(core): update 2020-12-07 03:47:39 +00:00
3 changed files with 8 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@designestate/dees-domtools",
"version": "1.0.80",
"version": "1.0.81",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@designestate/dees-domtools",
"version": "1.0.80",
"version": "1.0.81",
"private": false,
"description": "tools to simplify complex css structures",
"main": "dist_ts/index.js",

View File

@ -4,7 +4,7 @@ import * as plugins from './domtools.plugins';
export class ThemeManager {
public domtoolsRef: DomTools;
public goBrightBoolean = false;
public preferredColorSchemeMediaMatch = window.matchMedia('(prefers-color-scheme: light)');
@ -15,7 +15,7 @@ export class ThemeManager {
// lets care
this.goBrightBoolean = this.preferredColorSchemeMediaMatch.matches;
this.preferredColorSchemeMediaMatch.addEventListener('change', eventArg => {
this.preferredColorSchemeMediaMatch.addEventListener('change', (eventArg) => {
this.goBrightBoolean = eventArg.matches;
this.updateAllConnectedElements();
});
@ -23,7 +23,9 @@ export class ThemeManager {
}
private async updateAllConnectedElements() {
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
if (document.body && document.body.style) {
document.body.style.background = this.goBrightBoolean ? '#fff' : '#000';
}
this.themeObservable.next(this.goBrightBoolean);
}
@ -41,4 +43,4 @@ export class ThemeManager {
this.goBrightBoolean = !this.goBrightBoolean;
this.updateAllConnectedElements();
}
}
}