const sunTheme = {
images: {
theme_frame: "sun.jpg",
},
colors: {
frame: "#CF723F",
tab_background_text: "#111111",
},
};
browser.theme.update(sunTheme);theme.update() / notebook
theme.update()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const day = {
images: {
theme_frame: "sun.jpg",
},
colors: {
frame: "#CF723F",
tab_background_text: "#111111",
},
};
browser.menus.create({
id: "set-theme",
title: "set theme",
contexts: ["all"],
});
async function updateThemeForCurrentWindow() {
let currentWindow = await browser.windows.getLastFocused();
browser.theme.update(currentWindow.id, day);
}
browser.menus.onClicked.addListener(updateThemeForCurrentWindow);