Conversation
- Add DarkMode component - Add darkmode comp styling
Co-authored-by: Ed Brannin (BW) <86373302+ebrannin-bw@users.noreply.github.com>
src/style/_topbar.scss
Outdated
| opacity: 1; | ||
| } | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
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"); |
|
Hi! Is it possible to specify a light theme by default? Because when opening/refreshing a page, a dark theme is always set, the choice is not remembered. |
Closes swagger-api#5327, swagger-api#9964, swagger-api#10089 --------- Co-authored-by: Allan <workofcode@gmail.com> Co-authored-by: Ed Brannin (BW) <86373302+ebrannin-bw@users.noreply.github.com>
# [5.31.0](swagger-api/swagger-ui@v5.30.3...v5.31.0) (2025-12-11) ### Features * add dark mode ([swagger-api#10653](swagger-api#10653)) ([5f42eee](swagger-api@5f42eee)), closes [swagger-api#5327](swagger-api#5327) [swagger-api#9964](swagger-api#9964) [swagger-api#10089](swagger-api#10089)
# [5.31.0](swagger-api/swagger-ui@v5.30.3...v5.31.0) (2025-12-11) ### Features * add dark mode ([swagger-api#10653](swagger-api#10653)) ([5f42eee](swagger-api@5f42eee)), closes [swagger-api#5327](swagger-api#5327) [swagger-api#9964](swagger-api#9964) [swagger-api#10089](swagger-api#10089) ### Reverts * Revert "chore(release): cut the 5.31.0 release" ([swagger-api#10658](swagger-api#10658)) ([cf11271](swagger-api@cf11271))

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.