nzhenev's picture
but use sane graphic
d0fb2a8 verified
raw
history blame contribute delete
807 Bytes
// Theme toggle functionality
document.addEventListener('DOMContentLoaded', () => {
// Check for saved theme preference or use preferred color scheme
if (localStorage.getItem('color-theme') === 'dark' ||
(!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
});