summaryrefslogtreecommitdiff
path: root/scripts/light-dark.js
blob: 5f0b4d4187221721002b715c4cfa4837e1adf8b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';

(function() {
	var lightDark = document.getElementById("light-dark");

	function setButtonText() {
		if(window.Theme.get() == BASE_THEMES[0][0])
			lightDark.innerText = BASE_THEMES[1][1] + " Mode";
		else
			lightDark.innerText = BASE_THEMES[1][0] + " Mode";
	}

	function changeTheme(e) {
		if(window.Theme.get() == BASE_THEMES[0][0])
			window.Theme.set(BASE_THEMES[0][1]);
		else
			window.Theme.set(BASE_THEMES[0][0]);
		
		setButtonText();
	}

	lightDark.addEventListener("click", changeTheme);
	setButtonText();
})();