Fastapi: [FEATURE] Enable Dark Mode for official FastAPI website

Created on 21 Nov 2019  ·  16Comments  ·  Source: tiangolo/fastapi

Is your feature request related to a problem? Please describe.
The feature request is related to the website https://fastapi.tiangolo.com/

Describe the solution you'd like
It would be nice to have dark mode, that could either be manually switched on, and/or it could automatically check the time, and if it is past sunset, it would automatically switch on dark mode.

Describe alternatives you've considered
Firefox/Edge plugins for dark/night mode.

Additional context
My eyes are burning :) Jokes aside, consider please the solution implemented by the docker website: https://docs.docker.com/

enhancement

Most helpful comment

Syntax highlighting was significantly improved in 5.5.0 which was just released!

Bildschirmfoto 2020-07-24 um 13 25 34

All 16 comments

The documentation is generated using Material for MkDocs. Apparently, dark mode support is scheduled for v5: https://github.com/squidfunk/mkdocs-material/issues/1305

So I think it will be available at some point, but it's not something related to FastAPI.

Thanks for the feedback. Even though dark mode is not directly related to FastAPI, please consider providing the readers the dark mode option on the FastAPI homepage as soon as the feature is available.

Thanks in advance!

Thanks for the help here @frankie567 !

Yep, we'll have to wait first for it to be available in Material for MkDocs before it can be integrated here.

Thanks, I appreciate your proactivity!

Cool, as this is currently not dependant on FastAPI itself, I'm gonna close this issue now. But feel free to add more comments or create new issues.

With new dark theme #1760 it's become nearly impossible to read code examples.
image

Is it possible to create a switcher for light/dark theme? I don't want to change my OS theme just for one documentation   😄

Can we revert it until we have the switch button? We can wait for this (maybe): https://github.com/squidfunk/mkdocs-material/issues/1732

Hello,

How can I convert back to light theme, it is very to difficult to read now.

Appreciate your work
Thank you!

Syntax highlighting was significantly improved in 5.5.0 which was just released!

Bildschirmfoto 2020-07-24 um 13 25 34

I can't see the punctuation in the new color scheme
There are much more better ones out there (I suggest statistics about the most used ones if exists)

@Garito we're still improving on syntax highlighting. Feel free to open on issue over at squidfunk/mkdocs-material, explaining what you find difficult to read (ideally with screenshots), so we can roll out a fix quickly.

UPDATE:
https://github.com/squidfunk/mkdocs-material/issues/1862 tracks the problem and should be resolved within the next days.

Hello,

How can I convert back to light theme, it is very to difficult to read now.

Appreciate your work
Thank you!

I really love the dark theme but think that it would be really awesome to have a toggle somewhere on the docs 😁. Sometimes it's nice to grab a seat somewhere outside and with sunlight the dark theme is a bit hard to read.

Material for MkDocs 5.5.7 was just released, which ensures a contrast ratio of 4.5:1 for both, light and dark themes.

A toggle would be greatly appreciated.

Someone (I forgot the name) is working on a PR with the toggle on mkdocs side. 🎉

Yes, this is actively being worked on, see https://github.com/squidfunk/mkdocs-material/issues/1732 – For the time being, @tiangolo maybe consider setting the color scheme in mkdocs.yml to preference, which will automatically pick up the system settings, see this link.

Was this page helpful?
0 / 5 - 0 ratings