Fix elements styling to follow the Proton Design System more closely

This includes fixes for the hover, active and focus states of all the
elements that didn't have one.
This commit is contained in:
Danny Colin
2022-03-25 09:45:53 -04:00
parent 873ba0ab09
commit aaef0fd4a6
7 changed files with 593 additions and 439 deletions
+20
View File
@@ -169,6 +169,26 @@ const Utils = {
false
);
},
/* Theme helper
*
* First, we look if there's a theme already set in the local storage. If
* there isn't one, we set the theme based on `prefers-color-scheme`.
* */
getTheme(currentTheme, window) {
if (typeof currentTheme !== "undefined" && currentTheme !== "auto") {
return currentTheme;
}
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
return "dark";
}
return "light";
},
async applyTheme() {
const { currentTheme } = await browser.storage.local.get("currentTheme");
const popup = document.getElementsByTagName("html")[0];
const theme = Utils.getTheme(currentTheme, window);
popup.setAttribute("data-theme", theme);
}
};
window.Utils = Utils;