summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'themes/danix-xyz-hacker/assets/js')
-rw-r--r--themes/danix-xyz-hacker/assets/js/theme-toggle.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/assets/js/theme-toggle.js b/themes/danix-xyz-hacker/assets/js/theme-toggle.js
index 97ed1ce..3a4fda2 100644
--- a/themes/danix-xyz-hacker/assets/js/theme-toggle.js
+++ b/themes/danix-xyz-hacker/assets/js/theme-toggle.js
@@ -19,6 +19,20 @@ document.addEventListener('DOMContentLoaded', function() {
// Add the new theme class
htmlElement.classList.add(`theme-${newTheme}`);
+ // Update article type badge colors
+ const badges = document.querySelectorAll('[data-theme-dark-color]');
+ badges.forEach(badge => {
+ if (newTheme === 'dark') {
+ const darkColor = badge.getAttribute('data-theme-dark-color');
+ badge.style.color = darkColor;
+ badge.style.backgroundColor = darkColor + '20';
+ } else {
+ const lightColor = badge.style.color; // Already set to light in HTML
+ badge.style.color = lightColor;
+ // backgroundColor stays as is (light color with opacity)
+ }
+ });
+
// Persist to localStorage
localStorage.setItem('theme', newTheme);