Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark mode theme #171

Open
phette23 opened this issue Dec 5, 2024 · 0 comments
Open

Dark mode theme #171

phette23 opened this issue Dec 5, 2024 · 0 comments
Labels
frontend priority: low work on these last

Comments

@phette23
Copy link
Member

phette23 commented Dec 5, 2024

See this Code4Lib 2022 poster and CSS Tricks. Two examples:

CSS color-scheme may also be relevant here.

Basically, just add a new stylesheet with a media query and swap all the necessary colors within it. Certain sections (e.g. the main home page image) can probably remain as they are but a lot will need to change.

@media (prefers-color-scheme: dark) {
  /* Dark theme styles go here */
}

Or in JavaScript:

const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)")

if (prefersDarkScheme.matches) {
  document.body.classList.add("dark-theme")
} else {
  document.body.classList.remove("dark-theme")
}

After implementing dark mode, create a button to toggle between states and store the preferred state in localStorage so people can opt in/out if they want.

@phette23 phette23 added priority: low work on these last frontend labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend priority: low work on these last
Projects
None yet
Development

No branches or pull requests

1 participant