-
Notifications
You must be signed in to change notification settings - Fork 57
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
Option to toggle dark/light themes #272
Comments
No, there isn't a straightforward way to define light and dark themes (other than what you mentioned having two different theme css files and statically binding to one at render time). You could probably rig something up w/ JavaScript to do what you are hoping for but it might get pretty involved. |
Thanks @jjallaire ! I figured this would be the case. Please feel free to close this issue. Although I'm hoping a |
I would love to have this feature also ! |
I have a partial solution, maybe someone has an idea for fixing the current problem. Here are the steps: SetupIn
where
ProblemThis setup works for all the toplevel pages like index and listing pages but fails when opening individual posts. The reason for this is that when the posts are copied to the publish / docs directory, the links in the navbar are replaced. Meaning e.g. |
For those still interested, I coded a js solution to toggle a darkmode. It starts in the users prefered colorscheme and is toggle-able via a button. The choice is remembered in local storage. The css is still a little rough around the edges, as there appear to be a bunch of edgecases, tags and classes in distill, but it works. This is my website and here is the repo for it with the commit that added the darkmode: https://github.com/jmbuhr/jmbuhr.github.io/tree/c5093a3b882b1542f48ee0bfbdf2ea788b3a773f If you want to recreate this, what you need is:
|
I'm currently enjoying using the latest version of
distill
i.e.distill_1.1
.Thanks for making it.
I particularly liked the ease in which themes can now be changed. I was wondering
if it is possible to have an icon to flip between dark/light versions of themes?
I've seen this quite commonly in the Hugo Academic Theme in some blogs of
R
users.For
distill
, I presume this would require the user to createtheme-dark.css
andtheme-light.css
, but I'm unsure if it would be possible to have a toggle buttonfor this within
distill
.I thought to ask if it is easy to roll this within the existing
distill
setup, orif there are any plans to introduce this useful functionality?
Note: I'm currently using the break to update my
distill
blog, so flagging a fewissues that naturally arise when I'm testing out the new
distill
package. Iwill keep these to a minimum, since I appreciate how much work goes into making
this package 👍 .
The text was updated successfully, but these errors were encountered: