mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix case where theme color is empty
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user