-
Notifications
You must be signed in to change notification settings - Fork 523
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
Add dark mode for docs #180
Conversation
When I click a link in the documentation to go to another page it switches back to light mode? |
That should fix it, I wasn't saving the chosen theme anywhere. Now it's saved in localStorage and gets fetched on every page load. |
So, once it's in local storage - it is then impossible to let the OS dictate the color? I can't seem to get OS to dictate color once I manually select a color. |
Many websites offer 3 modes:
At the moment, it looks like this PR can only handle light or dark. |
Fantastic idea! I believe it is a valid implementation. |
Yes, at the moment it toggles between light and dark mode and keeps it's choice regardless of the system setting (For example, I believe https://chakra-ui.com/ does it like this). I could add a third state to the button that respects the OS preference, or change it to a dropdown that has choices for the three modes. I like how clean the single button looks so I'd try that first, but I've seen it done lots of different ways, so let me know what you think. |
I would really like it to respect the OS setting. The less you have to think about dark/light mode the better. |
I have a PCT cataract in my right eye, makes reading the light docs a little hard for me some days, Thanks for this PR! |
Very supportive of this. Proposed screenshots looks good. I would say it's important to allow for 3 modes though Optional Mode idea there are a number of sites that support this. |
Here's my feedback. Love it. Period. ❤️ |
Congrats on your first open source contribution, it will make a huge impact to the community if merged this PR. Maybe it will be great if we can customize our personal color mode. Cheers.😄 |
Bloomin love this, top work guys! To echo others, OS sensitive mode would be a fab idea! |
Looks great! |
Looks good... |
Perhaps the implementation should only save the preference to localStorage if it differs from the system default? edit: Just to add there are a lot of changes in package-lock.json (npm 6 vs 7 I think) |
It would be nice! |
I love it. I actually check for this option periodically. About theme switching, I like the proposal from @mnightingale - use the switch as overwrite of OS setting. Looking good! 🕶️ |
I would add some shadow to the panel here, the content is intended to be "floating above". Some shadow as the light version should help aliviate it. Otherwise, dark themes use lighter color variants to simulate the light above (the closest, the lighter). So I would suggest to either:
Regarding the persistance and overall, the chosing of the theme (light or dark), here's my two cents: Major OSs support theming already, and those are available to both, CSS and JS. There's two main ways to overcome this problem. I would suggest reading: https://tailwindcss.com/docs/dark-mode Overall, the strategy you chose depends on the goal, so:
|
awesome!!!!!! |
Thank you everyone for your suggestions! I just implemented the third color mode, which inherits the system preference. It's represented as the third state of the toggle button, a half shaded-in circle: On first visit, the site theme is set to the system preference. Then you can click the button to switch to dark mode, click it again to switch to light mode, and click a final time to go back to the system preference. Your theme preference is stored in Thank you @mnightingale for the footnotes about the build files and the package-lock.json, those have been corrected. I also moved the theme initializing code out of |
Don't implement changes just because someone in the thread mentions something - I will suggest any changes I want to see. No other suggested changes should be applied. 😄 |
This should've been done a long time ago! Thank you bro! :) |
Awesome! |
Thanks for this. |
Finally!! |
@FestiveAkp Cool!! How about the API docs as well? 🤣 https://laravel.com/api/master/index.html |
I thought I'd take a stab at creating a dark mode version of the docs:
Updated syntax highlighting under dark mode:
Updated footer:
The initial color setting is based on
prefers-color-scheme
. You can toggle between light and dark with the button on the header:The mobile version:
For the time being, dark mode has only been implemented on pages under /docs/*, the rest of the website should still be unchanged and only have light mode. This is my first open-source contribution, so any and all feedback would be definitely appreciated.