Skip to content

Fix ReDoc preview being unreadable in dark themes - #375

Open
tillig wants to merge 1 commit into
42Crunch:masterfrom
tillig:redoc-dark-mode
Open

tillig wants to merge 1 commit into
42Crunch:masterfrom
tillig:redoc-dark-mode

Conversation

@tillig

@tillig tillig commented Sep 8, 2026

Copy link
Copy Markdown

Fixes #356.

The webview shell adds dark-mode for both previews, but only the SwaggerUI stylesheet has rules for it — ReDoc keeps drawing its light theme text colors, which vanish against the dark background. This limits the class, and the dark body background with it, to the SwaggerUI preview.

Switching ReDoc to a dark theme instead isn't an option yet: it has no dark mode of its own (Redocly/redoc#2673), and darkening 2.x means hand-writing a theme object that Redoc 3 replaces with CSS design tokens. A light preview under a dark editor theme seemed the better place to sit until that upgrade.

shouldUseDarkMode is covered for both renderers across all four theme kinds; the test fails against the current logic and passes with the change. Also checked by hand in a dark theme.

@CLAassistant

CLAassistant commented Sep 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Vernholio

Vernholio commented Sep 9, 2026

Copy link
Copy Markdown

@tillig... Just for my clarification, this fix will let us work in dark mode in VS Code, but the ReDoc preview will display with the standard white background, right? If so, this 100% works for me. Really appreciate you doing the work for this!

@tillig

tillig commented Sep 9, 2026

Copy link
Copy Markdown
Author

@Vernholio Correct. Regardless of the OS or VS Code display mode, ReDoc will only ever display in light mode with this fix because that's the only mode it currently supports. A future PR could update to ReDoc 3 when it's available, which does support a true dark mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redoc appears broken in dark theme

3 participants