Code block dark mode bug - Shiki theme hardcoded to github-light
Describe the bug
When using Dark theme, code blocks inside assistant messages are rendered with Shiki's github-light theme. The code syntax colors are from the light palette (e.g. #d73a49 for keywords), which are unreadable on a dark background.
To Reproduce
- Switch OpenWork to Dark theme (Settings > Appearance)
- Send any message containing a code block
- Observe the code tokens use light colors (low contrast on dark bg)
Root cause
In apps/app/src/components/markdown/markdown.tsx line ~172, Shiki's theme is hardcoded to "github-light":
theme: "github-light",
It should be dynamic based on the app's current theme (github-dark in dark mode).
Workaround confirmed
Injecting filter: invert(1) hue-rotate(180deg) on .shiki.github-light elements via DevTools fixes the rendering.
Suggested fix
- theme: "github-light",
+ theme: document.documentElement.classList.contains("dark") ? "github-dark" : "github-light",
Environment
- OpenWork v0.17.x
- Windows
- Dark theme
Thank you @magic-peach 👍
Worked on this in PR #2467 . The fix makes Shiki follow the resolved app theme instead of hardcoding the light theme. @benjaminshafii @OmarMcAdam
Thank you @taneja-garvit 🙏
closed due to age, please reopen and tag me if still valid