blob: 04c624a914fb6e91f6c3c8edb04344279d842e94 [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
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +02004export default class CCDarkThemeInjectForcedDarkTheme extends StylesheetScript {
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02005 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}