Fix background colors not printed in custom theme CSS - #62
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #61
Summary
print-color-adjust: exactand-webkit-print-color-adjust: exactto.markdown-body, .markdown-body *inside@media print.markdown-bodyso the page/body background (e.g. dark theme's black background) is not affectedRoot Cause
Browsers ignore
background-colorandbackground-imagewhen printing by default. Custom theme CSS likeh1 { background: #0075e2; }was silently dropped in print preview despite being correctly applied on screen.Test plan
h1 { background: #0075e2; color: #fff; }and verify the background color appears in print preview🤖 Generated with Claude Code