From d6a604f69c045f7d05865c0e2a93fcfae272cdcc Mon Sep 17 00:00:00 2001 From: cocobo1 Date: Sun, 12 Oct 2025 15:09:48 +0300 Subject: [PATCH] fix(themes): fix the issue on startup while allowing reloadless themes to work with the old method --- src/lib/addons/themes/colors/updater.ts | 9 ++++++--- src/lib/addons/themes/index.ts | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/addons/themes/colors/updater.ts b/src/lib/addons/themes/colors/updater.ts index 3d1f7a2..b7d0e3f 100644 --- a/src/lib/addons/themes/colors/updater.ts +++ b/src/lib/addons/themes/colors/updater.ts @@ -27,7 +27,7 @@ export const _colorRef: InternalColorRef = { lastSetDiscordTheme: "darker" }; -export function updateBunnyColor(colorManifest: ColorManifest | null, { update = true }) { +export function updateBunnyColor(colorManifest: ColorManifest | null, { update = true, startup = true } ) { if (settings.safeMode?.enabled) return; const internalDef = colorManifest ? parseColorManifest(colorManifest) : null; @@ -52,11 +52,14 @@ export function updateBunnyColor(colorManifest: ColorManifest | null, { update = } if (update) { + AppearanceManager.setShouldSyncAppearanceSettings(false); + AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme); + } + + if (startup) { // scuffed but it works AppearanceManager.setShouldSyncAppearanceSettings(true); AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme); - AppearanceManager.setShouldSyncAppearanceSettings(false); - AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme); } } diff --git a/src/lib/addons/themes/index.ts b/src/lib/addons/themes/index.ts index 546c040..af13486 100644 --- a/src/lib/addons/themes/index.ts +++ b/src/lib/addons/themes/index.ts @@ -104,10 +104,10 @@ export function selectTheme(theme: VdThemeInfo | null, write = true) { ); if (theme == null && write) { - updateBunnyColor(null, { update: true }); + updateBunnyColor(null, { update: true, startup: false }); return writeThemeToNative({}); } else if (theme) { - updateBunnyColor(theme.data, { update: true }); + updateBunnyColor(theme.data, { update: true, startup: false }); return writeThemeToNative(theme); } }