Fixing an issue in a custom Obsidian theme where PDF diagrams in dark mode have unreadable text in diagram due to inappropriate color changes

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

Hi everyone!

I’ve been working on my own Obsidian theme and ran into an issue while testing PDFs. In dark mode, Obsidian changes the text color inside diagrams within PDFs, making them unreadable (e.g., turning text grey). I’d like the page background to remain black, but the diagram text should be properly visible, similar to the default dark mode theme.

I’ve experimented with the --pdf-page-background property and various colors, but the issue persists. The diagrams don’t seem to correspond to any identifiable HTML components, which complicates things. Additionally, I’ve replaced grey tones with amber in my theme, which helped identify the problem (screenshots below).

Does anyone have insights or a solution for this? Your help would be greatly appreciated!