Skip to content

Commit

Permalink
Added "Use system theme (auto)" to context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
FaridZelli authored Dec 17, 2023
1 parent 6805a9a commit 39b7fe1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@ function toggleTheme() {
}

browser.action.onClicked.addListener(toggleTheme);

function toggleSystemTheme() {
browser.management.get("[email protected]").then(info => {
browser.management.setEnabled("[email protected]", !info.enabled);
});
}

browser.menus.create({
id: "use-systemtheme",
type: "normal",
title: "Use system theme (auto)",
contexts: ["action"],
icons: {
"16": "icons/browser.svg",
"32": "icons/browser.svg"
},
});

browser.menus.onClicked.addListener(toggleSystemTheme);

0 comments on commit 39b7fe1

Please sign in to comment.