diff --git a/pages/base.html b/pages/base.html index 9d59350..14c9874 100644 --- a/pages/base.html +++ b/pages/base.html @@ -27,6 +27,11 @@
  • About
  • +
    + +
    Login Sign-up @@ -62,6 +67,24 @@ return; } + // Theme + let theme = localStorage.getItem("theme"); + if (theme) { + document.documentElement.setAttribute('data-bs-theme', theme); + } + + document.getElementById('theme-switch-btn').addEventListener('click', () => { + if (document.documentElement.getAttribute('data-bs-theme') == 'dark') { + document.documentElement.setAttribute('data-bs-theme','light'); + localStorage.setItem("theme", "light"); + document.getElementById("theme-svg").src = "/static/images/brightness-high.svg"; + } else { + document.documentElement.setAttribute('data-bs-theme','dark'); + localStorage.setItem("theme", "dark"); + document.getElementById("theme-svg").src = "/static/images/moon-stars.svg"; + } + }) + }, false) diff --git a/static/images/brightness-high.svg b/static/images/brightness-high.svg new file mode 100644 index 0000000..f00d050 --- /dev/null +++ b/static/images/brightness-high.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/static/images/moon-stars.svg b/static/images/moon-stars.svg new file mode 100644 index 0000000..ae138c2 --- /dev/null +++ b/static/images/moon-stars.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file