-
Notifications
You must be signed in to change notification settings - Fork 70
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
Improve dark mode support #57
Comments
Hey there! I’d love to have a go at this 😊 |
Awesome, thank you! :) I was thinking about a toggle at the top left corner in the header with three options:
There's a dark mode implementation already but I guess we should use custom properties to make it easier and more flexible. Browsers that don't support custom properties just fallback to the default theme. Here's what you need to do to get started.
Tell me, if I can assist you somehow. :) |
Cool, I'll pull the repo and have a look, I'll shout up when I've got something cooking 😄 |
What timescales did you have in mind for this? I can probably get this sorted by the end of the weekend. Does that work for you? |
By the end of the weekend, the month, or the year. It doesn't really matter, just enjoy yourself and build something awesome. :) |
If I can chime in with my 2 cents: if it is a toggle people will expect an on / off (or light / dark) functionality. |
I thought that it might be a good idea to add a third option after reading this https://kilianvalkhof.com/2020/design/your-dark-mode-toggle-is-broken/. So, it's just about giving users the option to reset their setting once they've clicked "light or dark". After thinking a little longer about it, I'm not sure any more if it's really necessary. What do you think @carolgilabert? |
I'm inclined to agree with you, and the article. If the light/dark choice is persisted, then I think we want to give people a choice to go back. |
As I was brave enough to submit a reply on HTMHell nr 20 (https://twitter.com/blue2blond/status/1265754248798785536), why not sharing some more (with the risk of taking the fun out of this issue). This boilerplate might come in handy:
Obviously, layout is completely up to you. It can be simple checkboxes such as at my own site (www.erwinhofman.nl) or a fancy styled toggler such as at www.cuebic.nl. A toggler construction with three states could be constructed yourself. One caveat: without JS, no darkmode support in this setup. I didn't solve this yet, as you would run into CSS inheritance issues and one have to create double CSS declarations (once using classes when JS is supported, and once when no classes are attached to the body and CSS media queries should be used). Code snippets could undoubtedly be shortened / improved. I just subtracted it from our codebase and rewrote it to vanilla JS and into a simple demo-page as I ran into this issue. Good luck! I am curious of the end result! |
How’s going @carolgilabert? Any progress? Can I help? 🙂 |
Hey! I'm really sorry for the radio silence, it's been a tough couple of weeks 😔 I started it a little bit ago, putting all the colours into custom properties. What I'll do is put my fork on netlify so I can show you progress as I go. But I'll also bear in mind the boilerplate above 🙂 |
No worries, looking forward to your first draft. :) |
Heya! I managed to get some time in on this 🎉 Branch: https://github.com/carolgilabert/HTMHell/tree/task/dark-mode-toggle It'd be useful to decide:
I have a bunch of next steps to do in the meantime, but keen to hear your thoughts on those and any early feedback you may have 🙂 |
Hey! Thanks! It works great and the top left position is also fine but it kinda looks like another logo. It'd be great if we could make it look like on Cassies website for example. A spinning pentagram on click would be beautiful. 😁 Just tell me if you need help with that. :) |
Hey all, |
That would be great! As far as I know, I'm not using custom properties, you can replace static color definitions with custom props, if you want to. Feel free to send me a PR. |
Hi @matuzo! :) Is this issue still being worked on? |
Light, Dark will always be light or dark.
System reacts to
@media (prefers-color-scheme: dark)
A spinning pentagram in the toggle when changing option would be nice.
Test in IE11
It's ok, but maybe you'll find something to improve it.
The text was updated successfully, but these errors were encountered: