aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/themeSwitcher.html
blob: 685bd823683e05ecbcb4b7e52ebddd0c31732775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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>