mirror of
https://github.com/cloudmaker97/DurstRechner.git
synced 2025-12-06 07:58:39 +00:00
15 lines
507 B
JavaScript
15 lines
507 B
JavaScript
function setBootstrapTheme(theme) {
|
|
document.documentElement.setAttribute('data-bs-theme', theme);
|
|
localStorage.setItem('bootstrap-theme', theme);
|
|
}
|
|
|
|
setBootstrapTheme(localStorage.getItem('bootstrap-theme') || 'light');
|
|
|
|
document.querySelectorAll('[data-toggle-bs-theme]').forEach(element => {
|
|
element.addEventListener('click', event => {
|
|
const theme = document.documentElement.getAttribute('data-bs-theme') === 'dark' ? 'light' : 'dark';
|
|
setBootstrapTheme(theme);
|
|
})
|
|
});
|
|
|
|
|