Skip to content

Fix background colors not printed in custom theme CSS - #62

Merged
patakuti merged 1 commit into
mainfrom
fix/print-color-adjust
Jun 20, 2026
Merged

Fix background colors not printed in custom theme CSS#62
patakuti merged 1 commit into
mainfrom
fix/print-color-adjust

Conversation

@patakuti

@patakuti patakuti commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Closes #61

Summary

  • Add print-color-adjust: exact and -webkit-print-color-adjust: exact to .markdown-body, .markdown-body * inside @media print
  • Scoped to .markdown-body so the page/body background (e.g. dark theme's black background) is not affected

Root Cause

Browsers ignore background-color and background-image when printing by default. Custom theme CSS like h1 { background: #0075e2; } was silently dropped in print preview despite being correctly applied on screen.

Test plan

  • Create a custom theme CSS with h1 { background: #0075e2; color: #fff; } and verify the background color appears in print preview
  • Verify built-in themes (github, simple, dark) still look correct in print preview
  • Verify the dark theme body background is NOT printed (page background stays white)

🤖 Generated with Claude Code

Add print-color-adjust: exact to .markdown-body and all its children
so that background-color, background-image, and other background
properties defined in custom themes are rendered correctly in print
preview. Scoped to .markdown-body to avoid printing the page/body
background (e.g. dark theme's black background).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@patakuti
patakuti merged commit 8b9df76 into main Jun 20, 2026
1 check passed
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.

Print: background colors in custom theme CSS not rendered

1 participant