From c40062189b6532c1b041b04cce7e880b767d6bf6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Nov 2024 14:56:03 +0100 Subject: [PATCH] Fix external theme switching We need to wait CSS loading --- client/src/app/core/theme/theme.service.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index 0f7ab2780..947d91f65 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts @@ -127,10 +127,17 @@ export class ThemeService { private loadThemeStyle (name: string) { const links = document.getElementsByTagName('link') + for (let i = 0; i < links.length; i++) { const link = links[i] if (link.getAttribute('rel').includes('style') && link.getAttribute('title')) { link.disabled = link.getAttribute('title') !== name + + if (!link.disabled) { + link.onload = () => this.injectColorPalette() + } else { + link.onload = undefined + } } }