How to set basic black text on white background colors for PDF export when using a dark theme?

Things I have tried

Searching the forum, the closest I could find was a post about styling code blocks to make the block readable when exporting to PDF.

What I’m trying to do

New Obsidian user here. I use the Wombat theme (dark). When I try to export my note to a PDF, the headings, which are a light beige/yellow and look great on a black background, are barely visible in the PDF export, which is a white page. How can I set it up so that regardless of my theme, the export to PDF is a simple black text on a white background?

Thankn you.

How often are you exporting? It might be easier to switch to the default theme for export and then back again.

That said, this snippet will make h1~h6 readable using the Wombat theme. Change the colors as desired.

@media print {
    :is(.markdown-preview-view, .markdown-rendered) {
        --h1-color: var(--color-red);
        --h2-color: var(--color-orange);
        --h3-color: var(--color-yellow);
        --h4-color: var(--color-green);
        --h5-color: var(--color-blue);
        --h6-color: var(--color-purple);

If you haven’t used CSS snippets before, here’s how →

You can further customize your theme by modifying its file in .obsidian/themes or by using CSS snippets. To use a snippet, simply save it in a CSS file in <your vault root>/.obsidian/snippets/ and enable it. We recommend editing the CSS file using something like Visual Studio Code or Sublime Text to properly highlight and format it, as invalid CSS will not work.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.