add fallback colors for color functions in case of error

This commit is contained in:
SethBurkart123
2024-04-07 16:30:57 +10:00
parent 5fb66eb304
commit 22b3666cf0
3 changed files with 6 additions and 1 deletions
+4
View File
@@ -15,6 +15,10 @@ function adjustLuminance(color: any, lum: any) {
}
export default function ColorLuminance(color: any, lum = 0) {
if (color == '' || color == null) {
// light cyan blue
return '#00bfff';
}
const colorRegex = /rgba?\(([^)]+)\)/gi; // Case-insensitive match for rgb() or rgba()
if (color.toLowerCase().includes('gradient')) {
+1 -1
View File
@@ -18,7 +18,7 @@ let DarkMode: any = null;
export function updateAllColors(storedSetting: any, newColor = null) {
// Determine the color to use
const selectedColor = newColor || storedSetting.selectedColor;
const selectedColor = newColor || storedSetting.selectedColor == '' ? '#007bff' : storedSetting.selectedColor;
if (storedSetting.transparencyEffects) {
document.documentElement.classList.add('transparencyEffects');