aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/themeSwitcher.html
blob: 902d8e3ccb9ea32e12df45c46889cf0fee2b1276 (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;
		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;
			const elt = document.getElementById('themes');
			elt.style.display = "block";
			elt.value = themeName;
		}
	})();
</script>