Color schemes: allow user to choose/toggle schemes
See original GitHub issueI checked that…
- … the documentation does not mention anything about my idea
- … to my best knowledge, my idea wouldn’t break something for other users
- … there are no open or closed issues that are related to my idea
Description
As of #1639 a dark palette scheme (slate
) was added. Discussions regarding adding a toggle for this have been discussed #1639 comments, #1716 comments, and #1266. This issue can capture these discussions. To keep this generalized, I will give my thoughts for potential solution in a comment.
Use Cases
While supporting different themes / schemes and defaulting based upon prefers-color-scheme
are phenomenal, adding a toggle would directly allow each user to manually set the theme according to their preferences.
Screenshots / Mockups
n/a
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:29 (21 by maintainers)
Top Results From Across the Web
Building a Color Scheme Toggle - ryanfiller.com
This post by Andy Bell (who for some reason goes by Hank Chizljaw sometimes) puts together a pretty clever way to handle user...
Read more >Themed websites with multiple color schemes the easy way
In this blog post I'm going to explain you how to apply and switch color schemes (themes) in a web application. I find...
Read more >Switch Between Color Schemes with CSS Variables and ...
In this tutorial, we'll discuss how to implement different color schemes on a website using CSS variables and one line of vanilla JavaScript. ......
Read more >color-scheme - CSS: Cascading Style Sheets - MDN Web Docs
The color-scheme CSS property allows an element to indicate which color schemes it can comfortably be rendered in.
Read more >Dark mode toggle - Jouni Kantola. Web developer.
How do you persist the user's choice? How do you reactivate the user's preference on return? Automagic toggle. Lately color schemes, especially ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for sharing your implementation! I’m planning to put it in the table of contents, as I’m thinking about moving some more stuff there like “Edit this page” and maybe a Print button, so like a context menu, which is why we need more space than just the icon. Also, maybe later, a language switch could land there. Let’s see how that works out.
I’ve started working on the theme toggle. As proposed in this issue, it’s possible to provide 2 or more alternate themes from which the user can choose. The chosen theme is persisted across requests and does not induce flickering upon page load. The author can specify an icon and a label for the theme:
This is the current concept – it always sticks to the lower right corner:
Positioning might change, as I’m still experimenting. This is how it looks in action (click on the image, if it doesn’t auto-play):
This feature will be released in Material for MkDocs Insiders as part of the Black Pearl Funding goal. It will first be exclusively available to sponsors.