openwork icon indicating copy to clipboard operation
openwork copied to clipboard

Code block dark mode bug - Shiki theme hardcoded to github-light

Open dungphan0038 opened this issue 5 months ago • 4 comments

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

  1. Switch OpenWork to Dark theme (Settings > Appearance)
  2. Send any message containing a code block
  3. 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

dungphan0038 avatar Jul 03 '26 06:07 dungphan0038

Thank you @magic-peach 👍

dungphan0038 avatar Jul 04 '26 00:07 dungphan0038

Worked on this in PR #2467 . The fix makes Shiki follow the resolved app theme instead of hardcoding the light theme. @benjaminshafii @OmarMcAdam

taneja-garvit avatar Jul 04 '26 05:07 taneja-garvit

Thank you @taneja-garvit 🙏

dungphan0038 avatar Jul 07 '26 07:07 dungphan0038

closed due to age, please reopen and tag me if still valid

OmarMcAdam avatar Oct 28 '26 22:10 OmarMcAdam