save selectedColor for non-destructive theme viewing

This commit is contained in:
SethBurkart123
2024-04-05 10:30:23 +11:00
parent 6937ca6660
commit ea6282460d
4 changed files with 14 additions and 4 deletions
+7 -1
View File
@@ -20,8 +20,14 @@ export const setTheme = async (themeId: string) => {
}
}
const originalSelectedColor = await browser.storage.local.get('selectedColor') as { selectedColor: string; };
await applyTheme(theme);
await browser.storage.local.set({ selectedTheme: themeId });
await browser.storage.local.set({
selectedTheme: themeId,
selectedColor: theme.defaultColour,
originalSelectedColor: originalSelectedColor.selectedColor
});
} catch (error) {
console.error('Error setting theme:', error);