19 lines
633 B
JavaScript
19 lines
633 B
JavaScript
|
const themes = ['default', 'xmin', 'winter', '1337', 'red']
|
||
|
|
||
|
themes.forEach(theme => {
|
||
|
document.getElementById("themes").insertAdjacentHTML('afterbegin', "<option id='" + theme + "'>" + theme + "</option>" )
|
||
|
});
|
||
|
|
||
|
function changeClientTheme(theme) {
|
||
|
let link = document.createElement("link");
|
||
|
link.rel = "stylesheet";
|
||
|
link.href = "/css/themes/" + theme + ".css";
|
||
|
document.head.appendChild(link);
|
||
|
}
|
||
|
|
||
|
function changetheme() {
|
||
|
localStorage.setItem("theme", document.getElementById('themes').value);
|
||
|
changeClientTheme(document.getElementById('themes').value)
|
||
|
}
|
||
|
|
||
|
changeClientTheme(localStorage.getItem('theme'))
|