Skip to content

How to make dark mode work? #285

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

Closed
lairdresearch opened this issue Mar 30, 2025 · 2 comments
Closed

How to make dark mode work? #285

lairdresearch opened this issue Mar 30, 2025 · 2 comments
Labels
question Further information is requested Stale

Comments

@lairdresearch
Copy link

lairdresearch commented Mar 30, 2025

I'm using svelect in a svelte 5 app under the Skeleton (https://skeleton.dev) framework and I'm having some issues with the styling. In particular, the css does not use class based styling, rather everything is done with css variables.

When I modify the variables, there's no good way to have a dark mode variant. ie. --sv-bg="white dark:black" is not going to work. I think you could use a version with class variables instead, or alternatively you need to double up the css variables to include a dark variant (eg. --sv-bg and --sv-bg-dark).

My current workaround is to detect dark mode and change the value (i.e. --sv-bg={is_dark ? 'black' : 'white'}) -- not the best approach I think.

OR I'm doing this totally wrong and I haven't read the documentation properly. Any ideas on how to deal with dark mode?

@mskocik
Copy link
Owner

mskocik commented Apr 2, 2025

Check the "theme" page in documentation. There is complete CSS example (switch themes to see different CSS)

@mskocik mskocik added the question Further information is requested label Apr 2, 2025
Copy link

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 3 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants