idealista-enhancer/src/DarkMode.js
2022-10-20 00:36:54 +02:00

20 lines
434 B
JavaScript

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);
}
}