fix palerColor with gradients

This commit is contained in:
SethBurkart123
2023-10-11 21:26:53 +11:00
parent c9e029643a
commit 504dbd1cd8
6 changed files with 82 additions and 52 deletions
+15 -1
View File
@@ -20,6 +20,7 @@ export function updateAllColors(storedSetting, newColor = null) {
// Mode-based properties, applied if storedSetting is provided
let modeProps = {};
console.log(DarkMode);
if (DarkMode !== null) {
modeProps = DarkMode ? {
"--background-primary": "#232323",
@@ -29,10 +30,12 @@ export function updateAllColors(storedSetting, newColor = null) {
"--background-primary": "#ffffff",
"--background-secondary": "#e5e7eb",
"--text-primary": "black",
"--better-pale": lightenAndPaleColor(selectedColor) // Wrap this in try-catch if needed
"--better-pale": lightenAndPaleColor(selectedColor)
};
}
console.log("modeProps:", modeProps);
// Dynamic properties, always applied
const rgbThreshold = GetThresholdofHex(selectedColor);
const isBright = rgbThreshold > 210;
@@ -50,3 +53,14 @@ export function updateAllColors(storedSetting, newColor = null) {
document.querySelector("link[rel*='icon']").href = getChromeURL("icons/icon-48.png");
}
}
export function getDarkMode() {
return new Promise((resolve, reject) => {
chrome.storage.local.get("DarkMode", (result) => {
if (chrome.runtime.lastError) {
return reject(chrome.runtime.lastError);
}
resolve(result.DarkMode);
});
});
}