Skip to content

Commit

Permalink
fix: theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Dec 5, 2024
1 parent 61977d4 commit 9dc6df3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ export const theme = (() => {

const onLight = () => {
theme.set('active', THEME_LIGHT);
document.documentElement.setAttribute('data-bs-theme', THEME_LIGHT);

const elements = document.querySelectorAll('.text-light, .btn-theme-light, .bg-dark, .bg-black, .bg-theme-dark, .color-theme-black, .btn-outline-light, .bg-cover-black');
elements.forEach((e) => observerLight.observe(e));
};

const onDark = () => {
theme.set('active', THEME_DARK);
document.documentElement.setAttribute('data-bs-theme', THEME_DARK);

const elements = document.querySelectorAll('.text-dark, .btn-theme-dark, .bg-light, .bg-white, .bg-theme-light, .color-theme-white, .btn-outline-dark, .bg-cover-white');
elements.forEach((e) => observerDark.observe(e));
Expand Down Expand Up @@ -168,8 +170,6 @@ export const theme = (() => {

o.disconnect();

document.documentElement.setAttribute('data-bs-theme', THEME_LIGHT);

const now = metaTheme.getAttribute('content');
metaTheme.setAttribute('content', themeDark.some((i) => i === now) ? themeColors[now] : now);
});
Expand All @@ -181,8 +181,6 @@ export const theme = (() => {

o.disconnect();

document.documentElement.setAttribute('data-bs-theme', THEME_DARK);

const now = metaTheme.getAttribute('content');
metaTheme.setAttribute('content', themeLight.some((i) => i === now) ? themeColors[now] : now);
});
Expand Down

0 comments on commit 9dc6df3

Please sign in to comment.