blob: 0a16a7036352b1246d67057b9a2a8502ab0f290a [file] [log] [blame]
Adrià Vilanova Martínezfe694782024-11-09 20:40:43 +01001import { ScriptPage } from '../../../../common/architecture/scripts/Script';
2import StylesheetScript from '../../../../common/architecture/scripts/stylesheet/StylesheetScript';
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02003
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}