Skip to content

fix: Apply theme style to embedded diagram#7903

Merged
NGPixel merged 3 commits into
requarks:mainfrom
tribut:fix-drawio-darkmode
Jan 20, 2026
Merged

fix: Apply theme style to embedded diagram#7903
NGPixel merged 3 commits into
requarks:mainfrom
tribut:fix-drawio-darkmode

Conversation

@tribut

@tribut tribut commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

When diagrams are created with "adaptive colors" they automatically change to light-/darkmode depending on the browser preference. This leads to rendering problems when the settings in the browser differ from the wiki.js theme setting.

Fixes #7677

Before After
image image

@auto-assign auto-assign Bot requested a review from NGPixel January 20, 2026 14:56
When diagrams are created with "adaptive colors" they automatically
change to light-/darkmode depending on the browser preference. This
leads to rendering problems when the settings in the browser differ
from the wiki.js theme setting.

Fixes requarks#7677
@tribut tribut force-pushed the fix-drawio-darkmode branch from 48bec1b to 65ee434 Compare January 20, 2026 14:57
Refactor SVG color scheme handling in diagram class.
Removed unnecessary direction property from first SVG in diagram.
@NGPixel NGPixel merged commit 3ba58f7 into requarks:main Jan 20, 2026
@NGPixel

NGPixel commented Jan 20, 2026

Copy link
Copy Markdown
Member

Thanks!

@tribut

tribut commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging, but color-scheme: light; is not enough, we need !important. The <svg> element has an inline style of color-scheme: light dark, which has higher specificity than our css rule.

With your changes, it will still automatically switch to dark mode if the browser has that preference set.

@tribut

tribut commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

I've created #7905 so I don't forget and it doesn't get buried in a closed PR. Again, thank you for your continued dedication.

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.

2 participants