mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
23 lines
909 B
TypeScript
23 lines
909 B
TypeScript
import { CustomTheme } from '../../../interface/types/CustomThemes';
|
|
import browser from 'webextension-polyfill';
|
|
|
|
export const removeTheme = async (theme: CustomTheme) => {
|
|
// Remove custom CSS
|
|
const styleElement = document.getElementById('custom-theme');
|
|
if (styleElement) {
|
|
styleElement.parentNode?.removeChild(styleElement);
|
|
}
|
|
|
|
// 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);
|
|
customImageVariables.forEach((variableName) => {
|
|
document.documentElement.style.removeProperty('--' + variableName);
|
|
});
|
|
};
|