mkdocs-exporter
mkdocs-exporter copied to clipboard
Use different color scheme to export PDFs
Suggestion: add a flag that lets users select certain color scheme
For instance, my site defaults to the slate (dark theme) but ideally I'd like the PDF exporter to use the default (light) theme in generating documents
theme:
palette:
# - media: "(prefers-color-scheme: dark)"
- scheme: slate
accent: amber
toggle:
icon: material/brightness-2
name: "Switch to light mode"
# - media: "(prefers-color-scheme: light)"
- scheme: default
accent: deep purple
toggle:
icon: material/brightness-5
name: "Switch to dark mode"
Hello @fengtality,
The light mode seems to be enforced when printing, based on the SCSS defined by MkDocs Material.
Now, concerning the accent colors not being respected, the issue seems to be coming from Paged.js after a quick look. I'll investigate further and provide a solution.
In the meantime, you may be able to override the CSS variables used by MkDocs Material during the rendering process (using the stylesheets property of the exporter-pdf plugin).
For instance, this documentation uses:
:root {
--md-primary-fg-color: #EA2027;
--md-accent-fg-color: #000000;
}
Closing for now, workarounds are available using CSS.