From 25a813d35f6de7bcb5a35918ae3e53ff67796f18 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 9 Jan 2025 00:33:46 +0100 Subject: [PATCH] fix(themamanager): Fixed automatic global theme change subscription for background updates. --- changelog.md | 5 +++++ ts/00_commitinfo_data.ts | 2 +- ts/domtools.classes.thememanager.ts | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index adc1344..a3a2819 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## 2025-01-09 - 2.1.1 - fix(themamanager) +Fixed automatic global theme change subscription for background updates. + +- Corrected the logic for updating the document's background color upon theme changes using themeObservable subscription. + ## 2025-01-09 - 2.1.0 - feat(themeManager) Exposed method to enable automatic global theme change. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 4247356..ed46008 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@design.estate/dees-domtools', - version: '2.1.0', + version: '2.1.1', description: 'A package providing tools to simplify complex CSS structures and web development tasks, featuring TypeScript support and integration with various web technologies.' } diff --git a/ts/domtools.classes.thememanager.ts b/ts/domtools.classes.thememanager.ts index d63b821..6bb13f0 100644 --- a/ts/domtools.classes.thememanager.ts +++ b/ts/domtools.classes.thememanager.ts @@ -23,7 +23,11 @@ export class ThemeManager { public async enableAutomaticGlobalThemeChange() { if (document.body && document.body.style) { - document.body.style.background = this.goBrightBoolean ? '#fff' : '#000'; + this.themeObservable.subscribe({ + next: (goBright) => { + document.body.style.background = goBright ? '#fff' : '#000'; + } + }); } }