mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
add fallback colors for color functions in case of error
This commit is contained in:
@@ -1556,6 +1556,7 @@ function CheckCurrentLesson(lesson: any, num: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function GetThresholdOfColor(color: any) {
|
export function GetThresholdOfColor(color: any) {
|
||||||
|
if (!color) return 0
|
||||||
// Case-insensitive regular expression for matching RGBA colors
|
// Case-insensitive regular expression for matching RGBA colors
|
||||||
const rgbaRegex = /rgba?\(([^)]+)\)/gi
|
const rgbaRegex = /rgba?\(([^)]+)\)/gi
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ function adjustLuminance(color: any, lum: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ColorLuminance(color: any, lum = 0) {
|
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()
|
const colorRegex = /rgba?\(([^)]+)\)/gi; // Case-insensitive match for rgb() or rgba()
|
||||||
|
|
||||||
if (color.toLowerCase().includes('gradient')) {
|
if (color.toLowerCase().includes('gradient')) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ let DarkMode: any = null;
|
|||||||
|
|
||||||
export function updateAllColors(storedSetting: any, newColor = null) {
|
export function updateAllColors(storedSetting: any, newColor = null) {
|
||||||
// Determine the color to use
|
// Determine the color to use
|
||||||
const selectedColor = newColor || storedSetting.selectedColor;
|
const selectedColor = newColor || storedSetting.selectedColor == '' ? '#007bff' : storedSetting.selectedColor;
|
||||||
|
|
||||||
if (storedSetting.transparencyEffects) {
|
if (storedSetting.transparencyEffects) {
|
||||||
document.documentElement.classList.add('transparencyEffects');
|
document.documentElement.classList.add('transparencyEffects');
|
||||||
|
|||||||
Reference in New Issue
Block a user