Files
webextensions-examples/private-browsing-theme/background.js
rebloor 0d46482e7d Remove retired theme aliases (#430)
* Remove required theme aliases

Replaced uses of headerURL, accentcolor, and textcolor with theme_frame, frame, and tab_background_text. Tested and confirmed all extensions working as expected.

* Fixed another reference to headerURL

Co-authored-by: Richard Bloor <rbloor@atlassian.com>
2020-03-23 17:00:00 -07:00

26 lines
595 B
JavaScript

browser.windows.onCreated.addListener(themeWindow);
// Theme all currently open windows
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
function themeWindow(window) {
// Check if the window is in private browsing
if (window.incognito) {
browser.theme.update(window.id, {
images: {
theme_frame: "",
},
colors: {
frame: "black",
tab_background_text: "white",
toolbar: "#333",
toolbar_text: "white"
}
});
}
// Reset to the default theme otherwise
else {
browser.theme.reset(window.id);
}
}