mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
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>
This commit is contained in:
@@ -3,20 +3,20 @@ var currentTheme = '';
|
|||||||
const themes = {
|
const themes = {
|
||||||
'day': {
|
'day': {
|
||||||
images: {
|
images: {
|
||||||
headerURL: 'sun.jpg',
|
theme_frame: 'sun.jpg',
|
||||||
},
|
},
|
||||||
colors: {
|
colors: {
|
||||||
accentcolor: '#CF723F',
|
frame: '#CF723F',
|
||||||
textcolor: '#111',
|
tab_background_text: '#111',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'night': {
|
'night': {
|
||||||
images: {
|
images: {
|
||||||
headerURL: 'moon.jpg',
|
theme_frame: 'moon.jpg',
|
||||||
},
|
},
|
||||||
colors: {
|
colors: {
|
||||||
accentcolor: '#000',
|
frame: '#000',
|
||||||
textcolor: '#fff',
|
tab_background_text: '#fff',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -535,7 +535,7 @@
|
|||||||
"name": "theme-switcher"
|
"name": "theme-switcher"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "A collection of themes illustrating:<ul><li>weta_fade: a basic theme employing a single image specified in <code>headerURL:</code>.</li><li>weta_fade_chrome: the weta_fade theme implemented with Chrome compatible manifest keys.</li><li>weta_tiled: a theme using a tiled image.</li><li>weta_mirror: a theme using multiple images and aligning those images in the header.</li><li>animated: use of an animated PNG.</li></ul>",
|
"description": "A collection of themes illustrating:<ul><li>weta_fade: a basic theme employing a single image specified in <code>theme_frame:</code>.</li><li>weta_fade_chrome: the weta_fade theme implemented with Chrome compatible manifest keys.</li><li>weta_tiled: a theme using a tiled image.</li><li>weta_mirror: a theme using multiple images and aligning those images in the header.</li><li>animated: use of an animated PNG.</li></ul>",
|
||||||
"javascript_apis": [],
|
"javascript_apis": [],
|
||||||
"name": "themes"
|
"name": "themes"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ function themeWindow(window) {
|
|||||||
if (window.incognito) {
|
if (window.incognito) {
|
||||||
browser.theme.update(window.id, {
|
browser.theme.update(window.id, {
|
||||||
images: {
|
images: {
|
||||||
headerURL: "",
|
theme_frame: "",
|
||||||
},
|
},
|
||||||
colors: {
|
colors: {
|
||||||
accentcolor: "black",
|
frame: "black",
|
||||||
textcolor: "white",
|
tab_background_text: "white",
|
||||||
toolbar: "#333",
|
toolbar: "#333",
|
||||||
toolbar_text: "white"
|
toolbar_text: "white"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ How to use the browser.theme.getCurrent(), browser.theme.onUpdated and the sideb
|
|||||||
|
|
||||||
## Instructions to try this
|
## Instructions to try this
|
||||||
|
|
||||||
- Install a WebExtension theme that sets `accentcolor`, `toolbar` or `toolbar_text`
|
- Install a WebExtension theme that sets `frame`, `toolbar` or `toolbar_text`
|
||||||
- Install this extension
|
- Install this extension
|
||||||
- The sidebar should then use colors from the WebExtension theme
|
- The sidebar should then use colors from the WebExtension theme
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
function setSidebarStyle(theme) {
|
function setSidebarStyle(theme) {
|
||||||
const myElement = document.getElementById("myElement");
|
const myElement = document.getElementById("myElement");
|
||||||
|
|
||||||
// colors.frame and colors.accentcolor are aliases
|
if (theme.colors && theme.colors.frame) {
|
||||||
if (theme.colors && (theme.colors.accentcolor || theme.colors.frame)) {
|
|
||||||
document.body.style.backgroundColor =
|
document.body.style.backgroundColor =
|
||||||
theme.colors.accentcolor || theme.colors.frame;
|
theme.colors.frame;
|
||||||
} else {
|
} else {
|
||||||
document.body.style.backgroundColor = "white";
|
document.body.style.backgroundColor = "white";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## What it does
|
## What it does
|
||||||
|
|
||||||
Employs an animated PNG image as the headerURL image in a theme.
|
Employs an animated PNG image as the theme_frame image in a theme.
|
||||||
|
|
||||||
## What it shows
|
## What it shows
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## What it does
|
## What it does
|
||||||
|
|
||||||
Employs a PNG image as the headerURL image in a theme.
|
Employs a PNG image as the theme_frame image in a theme.
|
||||||
|
|
||||||
## What it shows
|
## What it shows
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user