aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/themeSwitcher.html
blob: 97818785c5bedcd769ea02d78c37467f36a3583d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<script>
	function setTheme() {
		const themeName = document.getElementById('themes').value;
		document.documentElement.className = themeName;
		localStorage.setItem('theme', themeName);
	}
	(function () {  // Set the theme on page load
		const elt = document.getElementById('themes');
		elt.style.display = 'block';
		const themeName = localStorage.getItem('theme');
		if (themeName) {
			document.documentElement.className = themeName;
			elt.value = themeName;
		}
	})();
</script>