From abca9c00511d94c4695c190b5e8724ce8b105fc8 Mon Sep 17 00:00:00 2001 From: razonyang Date: Tue, 16 Aug 2022 09:37:41 +0800 Subject: [PATCH] fix: replace data-theme with data-bs-theme to be compatible with Bootstrap dark mode --- assets/js/mode/index.ts | 3 ++- layouts/_default/baseof.html | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/js/mode/index.ts b/assets/js/mode/index.ts index 2cb596f3a..6db3ff09d 100644 --- a/assets/js/mode/index.ts +++ b/assets/js/mode/index.ts @@ -70,7 +70,8 @@ class ModeToggle implements Component { value = getPreferMode(); } console.debug(`Switch to ${value} mode`); - document.body.parentElement.setAttribute('data-theme', value); + document.body.parentElement.setAttribute('data-theme', value); // TODO: remove in v1 + document.body.parentElement.setAttribute('data-bs-theme', value); const event = new CustomEvent('hbs:mode', { detail: { mode: value } }); document.dispatchEvent(event); } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1a124535a..72b9bbe0e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,7 +3,9 @@ {{- if not (in (slice "light" "dark" "auto") $color) }} {{- $color = "auto" }} {{- end }} -