theme.getCurrent()
Retourne le theme utilisé actuellement sous la forme d'un objet Theme
. Les arguments disponible dans l'objet couleur sont listés dans les propriétés de la couleur.
Il s'agit d'une fonction asynchrone qui renvoie un objet Promise
.
Syntaxe
var getting = browser.theme.getCurrent(
windowId, // integer
);
Paramètres
windowId
Facultatif-
integer
. L'ID d'une fenêtre. Si cela est indiqué, le thème appliqué sur cette fenêtre sera retourné. Sinon le thème appliqué sur la dernière fenêtre active sera retourné.
Valeur retournée
Un objet Promise
. L'objet Promise sera résolu avec un objet theme.Theme
représentant le thème appliqué à la fenêtre spécifiée. Si aucun thème provenant d'une extension a été appliqué, l'objet Promise sera résolu avec un objet vide.
Compatibilité des navigateurs
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
getCurrent |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
Exemples
Obtient les propriétés des couleurs accentcolor
et toolbar
dans le thème actuel.
function getStyle(themeInfo) {
if (themeInfo.colors) {
console.log("accent color : " + themeInfo.colors.accentcolor);
console.log("toolbar : " + themeInfo.colors.toolbar);
}
}
async function getCurrentThemeInfo() {
var themeInfo = await browser.theme.getCurrent();
getStyle(themeInfo);
}
getCurrentThemeInfo();