MCPcopy
hub / github.com/darkreader/darkreader / setIcon

Method setIcon

src/background/icon-manager.ts:68–105  ·  view source on GitHub ↗
({isActive = this.iconState.active, colorScheme = 'dark', tabId}: IconOptions)

Source from the content-addressed store, hash-verified

66 }
67
68 static setIcon({isActive = this.iconState.active, colorScheme = 'dark', tabId}: IconOptions): void {
69 if (__THUNDERBIRD__ || !chrome.browserAction.setIcon) {
70 // Fix for Firefox Android and Thunderbird.
71 return;
72 }
73 // Temporary disable per-site icons
74 // eslint-disable-next-line no-empty
75 if (colorScheme === 'dark') {
76 }
77 if (tabId) {
78 return;
79 }
80
81 this.iconState.active = isActive;
82
83 let path = this.ICON_PATHS.activeDark;
84 if (isActive) {
85 // Temporary disable the gray icon
86 // path = colorScheme === 'dark' ? IconManager.ICON_PATHS.activeDark : IconManager.ICON_PATHS.activeLight;
87 path = IconManager.ICON_PATHS.activeDark;
88 } else {
89 // Temporary disable the gray icon
90 // path = colorScheme === 'dark' ? IconManager.ICON_PATHS.inactiveDark : IconManager.ICON_PATHS.inactiveLight;
91 path = IconManager.ICON_PATHS.activeLight;
92 }
93
94 // Temporary disable per-site icons
95 /*
96 if (tabId) {
97 chrome.browserAction.setIcon({tabId, path});
98 } else {
99 chrome.browserAction.setIcon({path});
100 IconManager.handleUpdate();
101 }
102 */
103 chrome.browserAction.setIcon({path});
104 IconManager.handleUpdate();
105 }
106
107 static showBadge(text: string): void {
108 IconManager.iconState.badgeText = text;

Callers 4

initMethod · 0.80
sendDocumentMessageMethod · 0.80
onAppToggleMethod · 0.80
onSettingsChangedMethod · 0.80

Calls 1

handleUpdateMethod · 0.80

Tested by

no test coverage detected