OpenMediaCenter/src/GlobalInfos.js

38 lines
922 B
JavaScript
Raw Normal View History

import darktheme from './AppDarkTheme.module.css';
import lighttheme from './AppLightTheme.module.css';
/**
* This class is available for all components in project
* it contains general infos about app - like theme
*/
class StaticInfos {
#darktheme = true;
2020-07-27 21:14:56 +02:00
/**
* check if the current theme is the dark theme
* @returns {boolean} is dark theme?
*/
isDarkTheme() {
2020-07-27 21:14:56 +02:00
return this.#darktheme;
};
2020-07-27 21:14:56 +02:00
/**
* setter to enable or disable the dark or light theme
* @param enable enable the dark theme?
*/
enableDarkTheme(enable = true) {
2020-07-27 21:14:56 +02:00
this.#darktheme = enable;
}
/**
* get the currently selected theme stylesheet
* @returns {*} the style object of the current active theme
*/
getThemeStyle() {
return this.isDarkTheme() ? darktheme : lighttheme;
}
}
const GlobalInfos = new StaticInfos();
export default GlobalInfos;