1
Fork 0

Pick themes on settings page, not every page

This hides the paintbrush icon on most pages by default, in preference
for the settings on the settings page.  When loading from a local file,
and not in mobile view, continue to show the theme picker. That's
because some browsers limit access to localStorage from file:/// URLs,
so choosing a theme from settings.html doesn't take effect.
This commit is contained in:
Jacob Hoffman-Andrews 2022-01-05 22:20:26 -05:00
parent ad46af2471
commit c4b994ff80
3 changed files with 12 additions and 12 deletions

View file

@ -129,10 +129,15 @@ function hideThemeButtonState() {
// Set up the theme picker list.
(function () {
if (!document.location.href.startsWith("file:///")) {
return;
}
var themeChoices = getThemesElement();
var themePicker = getThemePickerElement();
var availableThemes = getVar("themes").split(",");
removeClass(themeChoices.parentElement, "hidden");
function switchThemeButtonState() {
if (themeChoices.style.display === "block") {
hideThemeButtonState();