/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** * Returns the string value of the current theme, * like "dark" or "light".
*/ const getTheme = (exports.getTheme = () => { const theme = getThemePrefValue(); if (theme == "auto") { return getAutoTheme();
} return theme;
});
/** * Returns the value of the pref of the current theme, * like "auto", "dark" or "light".
*/ const getThemePrefValue = (exports.getThemePrefValue = () => { return Services.prefs.getCharPref(THEME_PREF, "");
});
/** * Returns the color of a CSS variable (--theme-toolbar-background, --theme-highlight-red), * for the current toolbox theme, or null if the variable does not exist, or it's not a * registered property, or doesn't have a <color> syntax. * * @param {String} variableName * @param {Window} win: The window into which the variable should be defined. * @returns {String|null}
*/ const getCssVariableColor = (exports.getCssVariableColor = (
variableName,
win
) => { const value = win
.getComputedStyle(win.document.documentElement)
.getPropertyValue(variableName);
if (!value) {
console.warn("Unknown", variableName, "CSS variable"); returnnull;
}
return value;
});
/** * Set the theme preference.
*/ const setTheme = (exports.setTheme = newTheme => {
Services.prefs.setCharPref(THEME_PREF, newTheme);
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.