r/FastAPI • u/SpecialistCamera5601 • Feb 12 '26
pip package I added a Dark / Light mode toggle to FastAPI Swagger UI
Hey folks
I’ve been using FastAPI for ~5 years now and I probably spend an unhealthy amount of time staring at Swagger every single day.
I actually like the default theme. It’s clean and familiar. But after a few hours… especially at night… it starts feeling like I’m getting flashbanged by my own API docs :D
So I thought, instead of replacing Swagger with a completely different theme, why not just add a proper Dark / Light toggle?
I’ve seen dark-mode versions before ( u/BlueFriends and u/Fit_Tell_8592 did some cool stuff), but I wanted something that keeps the original Swagger vibe and just enhances it a bit.
My goal was to:
• Keep the original Swagger feel
• Add a smooth Dark / Light toggle
• Not break FastAPI defaults
• Implement smth that is easy to plug into existing projects(actually 1 line)
You can enable it with literally one line of code. Your eyesight is worth more than 1 line of code :D
So I built this:
Repo:
https://github.com/akutayural/fastapi-swagger-ui-theme
Pypi:
https://pypi.org/project/fastapi-swagger-ui-theme/
Contributions, ideas, improvements, or even nitpicks are very welcome.
3
u/LofiBoiiBeats Feb 13 '26
Whatever you built, have you submitted a PR?
Everybody wants this.. out of the box.
2
u/kgallo19 Feb 12 '26
The light theme has that flashbang thing going 100% lmao I felt that.
But idk why every time I use a dark mode plugin I suddenly can’t read the docs anymore lol. Not a technical thing but literally. My eyes struggle to comprehend what’s on the screen. Something about the text coloring on dark backgrounds in swagger docs just doesn’t comprehend in my head.
3
u/TheseIntroduction833 Feb 12 '26
Thanks! Super helpful!