Skip to content

Commit 39b7fe1

Browse files
authored
Added "Use system theme (auto)" to context menu
1 parent 6805a9a commit 39b7fe1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

background.js

+19
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,22 @@ function toggleTheme() {
1616
}
1717

1818
browser.action.onClicked.addListener(toggleTheme);
19+
20+
function toggleSystemTheme() {
21+
browser.management.get("default-theme@mozilla.org").then(info => {
22+
browser.management.setEnabled("default-theme@mozilla.org", !info.enabled);
23+
});
24+
}
25+
26+
browser.menus.create({
27+
id: "use-systemtheme",
28+
type: "normal",
29+
title: "Use system theme (auto)",
30+
contexts: ["action"],
31+
icons: {
32+
"16": "icons/browser.svg",
33+
"32": "icons/browser.svg"
34+
},
35+
});
36+
37+
browser.menus.onClicked.addListener(toggleSystemTheme);

0 commit comments

Comments
 (0)