idealista-enhancer/src/DarkMode.js

20 lines
434 B
JavaScript
Raw Normal View History

import Preferences from "./Preferences.js";
import Styles from "./Styles.js";
export default class DarkMode {
static STYLES_KEY = 'midefos-idealista-dark-mode';
static apply() {
if (Preferences.get('darkMode')) {
this._addDarkMode();
} else {
Styles.remove(this.STYLES_KEY);
}
}
static _addDarkMode() {
Styles.add(Styles.DARK_MODE, this.STYLES_KEY);
}
}