-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat: add dark mode #10653
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
feat: add dark mode #10653
Conversation
- Add DarkMode component - Add darkmode comp styling
Co-authored-by: Ed Brannin (BW) <[email protected]>
src/style/_topbar.scss
Outdated
| opacity: 1; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no empty line at the end
|
Great work @glowcloud ! - happy to see this much needed feature making it's way toward being in swagger. |
|
what a Christmas present, thanks! |
|
🎉 This PR is included in version 5.31.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
How to use it with react? <div
ref={() => {
SwaggerUIBundle({
docExpansion: 'list',
dom_id: '#swagger-ui',
url: `${apiUri}/doc.json`,
});
}}
id="swagger-ui"
/> |
Hi @simPod, Currently there is no option to use the dark mode by default and the toggle button is displayed only in the top bar when using the document.documentElement.classList.add("dark-mode"); |

Refs #5327, #9964, #10089
Supersedes #10216
Adds dark mode toggle to the top bar in standalone preset. If not using standalone preset, dark mode can also be enabled by adding
dark-modeclass to the<html>element, e.g.:NOTE: Class component was used for
DarkModeToggleas a workaround, as there were issues with duplicated React, causing hooks to be unusable. Alternative solution exists with the usage of Redux and dropping support for loading preferred colours, but opted for this one for now.