blob: ebd221b5f00400ce6a95eda1d520227a2cd0ebc1 [file] [log] [blame]
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02001import { ScriptPage } from '../../../common/architecture/scripts/Script';
2import StylesheetScript from '../../../common/architecture/scripts/stylesheet/StylesheetScript';
3
4export default class InjectForcedDarkTheme extends StylesheetScript {
5 stylesheet = 'ccDarkTheme.bundle.css';
6 page = ScriptPage.CommunityConsole;
7
8 async shouldBeInjected(): Promise<boolean> {
9 const ccDarkThemeEnabled =
10 await this.optionsProvider.isEnabled('ccdarktheme');
11 const ccDarkThemeMode =
12 await this.optionsProvider.getOptionValue('ccdarktheme_mode');
13 const ccDarkThemeSwitchEnabled = await this.optionsProvider.isEnabled(
14 'ccdarktheme_switch_status',
15 );
16
17 return (
18 ccDarkThemeEnabled &&
19 ccDarkThemeMode === 'switch' &&
20 ccDarkThemeSwitchEnabled
21 );
22 }
23}