MCPcopy
hub / github.com/darkreader/darkreader / onAppToggle

Method onAppToggle

src/background/extension.ts:623–637  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

621 //
622
623 private static onAppToggle() {
624 if (Extension.isExtensionSwitchedOn()) {
625 IconManager.setIcon({isActive: true, colorScheme: UserStorage.settings.theme.mode ? 'dark' : 'light'});
626 } else {
627 IconManager.setIcon({isActive: false, colorScheme: UserStorage.settings.theme.mode ? 'dark' : 'light'});
628 }
629
630 if (UserStorage.settings.changeBrowserTheme) {
631 if (Extension.isExtensionSwitchedOn() && Extension.autoState !== 'scheme-light') {
632 setWindowTheme(UserStorage.settings.theme);
633 } else {
634 resetWindowTheme();
635 }
636 }
637 }
638
639 private static async onSettingsChanged(onlyUpdateActiveTab = false) {
640 await Extension.loadData();

Callers 3

startMethod · 0.80
ExtensionClass · 0.80
changeSettingsMethod · 0.80

Calls 4

setWindowThemeFunction · 0.90
resetWindowThemeFunction · 0.90
isExtensionSwitchedOnMethod · 0.80
setIconMethod · 0.80

Tested by

no test coverage detected