fix case where theme color is empty

This commit is contained in:
SethBurkart123
2024-04-07 16:40:14 +10:00
parent 22b3666cf0
commit 22c51e3fb8
4 changed files with 6 additions and 4 deletions
@@ -25,7 +25,7 @@ async function GetTheme() {
async function SetTheme(theme: string) {
localStorage.setItem('selectedBackground', theme);
await browser.storage.local.set({ theme });
//await browser.storage.local.set({ theme });
}
function BackgroundSelector({ isEditMode, disableTheme }: BackgroundSelectorProps) {
+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 == '' ? '#007bff' : storedSetting.selectedColor;
const selectedColor = newColor || (storedSetting.selectedColor !== '' ? storedSetting.selectedColor : '#007bff');
if (storedSetting.transparencyEffects) {
document.documentElement.classList.add('transparencyEffects');
+2
View File
@@ -10,7 +10,9 @@ export const removeTheme = async (theme: CustomTheme) => {
// Reset default color
const originalSelectedColor = await browser.storage.local.get('originalSelectedColor') as { originalSelectedColor: string; };
if (originalSelectedColor.originalSelectedColor !== '') {
await browser.storage.local.set({ selectedColor: originalSelectedColor.originalSelectedColor });
}
// Remove custom images
const customImageVariables = theme.CustomImages.map((image) => image.variableName);
+1 -1
View File
@@ -30,7 +30,7 @@ export const setTheme = async (themeId: string) => {
await browser.storage.local.set({
selectedTheme: themeId,
selectedColor: theme.defaultColour,
selectedColor: theme.defaultColour !== '' ? theme.defaultColour : '#007bff',
originalSelectedColor: originalSelectedColor.selectedColor
});