forked from colin/resume
2
0
Fork 0

Enhance theme toggle accessibility and confirm auto mode default

This commit is contained in:
Your Name 2025-03-31 04:39:44 -04:00
parent 015f8ce76f
commit 39caf88782
2 changed files with 10 additions and 1 deletions

View File

@ -155,13 +155,18 @@ hr {
cursor: pointer;
font-size: 14px;
color: var(--text-color);
transition: background-color 0.3s ease;
transition: all 0.3s ease;
}
#themeToggle:hover {
background-color: var(--theme-hover);
}
#themeToggle:focus {
outline: 2px solid var(--accent-color);
outline-offset: 2px;
}
@media (max-width: 600px) {
body {
padding: 10px;

View File

@ -4,6 +4,10 @@ document.addEventListener('DOMContentLoaded', function() {
// Check for saved theme preference, default to auto
const savedTheme = localStorage.getItem('theme') || 'auto';
// Set initial value for aria-pressed attribute
themeToggle.setAttribute('aria-pressed', savedTheme !== 'auto');
updateTheme(savedTheme);
function updateTheme(theme) {