Files
oai-swift/oAI
rune b0f3049d6b Make PDF export actually dark
Two things were fighting the previous dark-PDF attempt, both
confirmed by direct experimentation:

- prefers-color-scheme is ignored entirely by the print pipeline —
  identical CSS printed light even with the webview's appearance
  forced to dark. Screen dark-mode media queries just don't apply to
  NSPrintOperation rendering.
- Even with dark colors set unconditionally (no media query), the
  print pipeline still dropped every background color and printed
  white — browsers/WebKit strip background-color/background-image by
  default when printing, to save ink, unless told otherwise via
  print-color-adjust: exact.

PDF now has its own always-dark stylesheet (pdfCss) instead of the
prefers-color-scheme-driven one HTML export still uses, plus
`* { print-color-adjust: exact }` so the dark backgrounds actually
survive the print pass. html(name:messages:) takes a new
forceDarkCSS parameter (default false, unchanged for HTML/other
callers); pdfData passes true. Dropped the now-pointless
webView.appearance forcing, since dark is unconditional now.

Verified with the same standalone repro-script + Read-the-PDF method:
dark page background, colored message boxes, dark code block, all
correctly surviving the real A4 print pipeline.
2026-07-29 12:37:18 +02:00
..
2026-06-29 14:04:27 +02:00
2026-07-29 12:37:18 +02:00