diff options
author | Julien Dessaux | 2023-01-25 17:45:06 +0100 |
---|---|---|
committer | Julien Dessaux | 2023-01-25 18:59:53 +0100 |
commit | 627f1f5d32ebeb89c41f72d960b4ab35778f7625 (patch) | |
tree | 29bd5f7531bd5bfe9c06c93f9166fdbd704676b9 /layouts/partials/themeSwitcher.html | |
parent | Updated last blog article (diff) | |
download | www-627f1f5d32ebeb89c41f72d960b4ab35778f7625.tar.gz www-627f1f5d32ebeb89c41f72d960b4ab35778f7625.tar.bz2 www-627f1f5d32ebeb89c41f72d960b4ab35778f7625.zip |
Added themes
Diffstat (limited to '')
-rw-r--r-- | layouts/partials/themeSwitcher.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/layouts/partials/themeSwitcher.html b/layouts/partials/themeSwitcher.html new file mode 100644 index 0000000..685bd82 --- /dev/null +++ b/layouts/partials/themeSwitcher.html @@ -0,0 +1,14 @@ +<script> + function setTheme() { + const themeName = document.getElementById('themes').value; + localStorage.setItem('theme', themeName); + document.documentElement.className = themeName; + } + (function () { // Set the theme on page load + const themeName = localStorage.getItem('theme'); + if (themeName) { + document.documentElement.className = themeName; + document.getElementById('themes').value = themeName; + } + })(); +</script> |