From 4c84645f2d78239aa9ddfc396f38d5efc2045ff9 Mon Sep 17 00:00:00 2001 From: patakuti Date: Sat, 20 Jun 2026 10:52:38 +0900 Subject: [PATCH] Fix background colors not printed in custom theme CSS 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 --- internal/template/css.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/template/css.go b/internal/template/css.go index f8857f2..410d9eb 100644 --- a/internal/template/css.go +++ b/internal/template/css.go @@ -19,6 +19,10 @@ body { margin: 0; padding: 0; } .theme-switcher select { padding: 2px 6px; font-size: 13px; } @media print { .toolbar { display: none; } + .markdown-body, .markdown-body * { + -webkit-print-color-adjust: exact; + print-color-adjust: exact; + } table, pre, .math.display, img, blockquote, li { break-inside: avoid; } h1, h2, h3, h4, h5, h6 { break-after: avoid; } }