const themes = ['default', 'xmin', 'winter', '1337', 'red', 'red2']

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'))