Summary Files Commits Branches @commit @diff @stats
path: root / src / scripts / theme-changer.js
blob: 4b5ca1bafd0c05f8a676f72257600eeb1d466883 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const themeBtn = document.getElementById('changeThemeBtn');

if (darkThemeStyle.disabled)
	themeBtn.src = '/img/moon-tabler.svg';

themeBtn.style.display = 'initial';

themeBtn.onclick = function() {
	darkThemeStyle.disabled = !darkThemeStyle.disabled;

	if (localStorage.getItem('theme') !== 'light') {
		themeBtn.src = '/img/moon-tabler.svg';
		localStorage.setItem('theme', 'light');
	}
	else {
		themeBtn.src = '/img/sun-tabler.svg';
		localStorage.setItem('theme', 'dark');
	}
}