Как сохранить динамический дизайн страницы в localstorage

У меня по клику на кнопку меняется дизайн страницы. Как мне сохранить его после перезагрузки через localStorage ?

const swapColors = () => {
    const items = document.querySelectorAll('.item-link')
    items.forEach(item => {
        item.classList.toggle('item-link-swapped')
    });
}


const button = document.querySelector('.swap-colors');
button.addEventListener('click', swapColors);
.main-menu .item-link{
    text-decoration: none;
    color: #485863;
    font-family: 'Roboto', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 27px;
    line-height: 27px;
}

.main-menu .item-link-swapped{
    color: #e0008d;
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 27px;
    line-height: 27px;
}

Вот пример css, по нажатию на кнопку у меня меняется класс у элемента, мне надо сохранить этот класс после перезагрузки.


Ответы (0 шт):