blob: c1bf0a11170d104ec7b9a6d90326110aff1e928e [file] [log] [blame]
import { ScriptPage } from '../../../common/architecture/scripts/Script';
import StylesheetScript from '../../../common/architecture/scripts/stylesheet/StylesheetScript';
export default class CCDarkThemeInjectAutoDarkTheme extends StylesheetScript {
stylesheet = 'ccDarkTheme.bundle.css';
attributes = { media: '(prefers-color-scheme: dark)' };
page = ScriptPage.CommunityConsole;
async shouldBeInjected(): Promise<boolean> {
const ccDarkThemeEnabled =
await this.optionsProvider.isEnabled('ccdarktheme');
const ccDarkThemeMode =
await this.optionsProvider.getOptionValue('ccdarktheme_mode');
return ccDarkThemeEnabled && ccDarkThemeMode === 'system';
}
}