forked from colin/resume
Enhance theme toggle accessibility and confirm auto mode default
This commit is contained in:
parent
015f8ce76f
commit
39caf88782
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue