Repository navigation
Themes
(since 3.2) A theme lays a company look over a style: your font, your colours, a header and footer with your logo, and a cover page. It is a small text file:
# acme.theme
font = fonts/AcmeSans-Regular.ttf
font-bold = fonts/AcmeSans-Bold.ttf
font-italic = fonts/AcmeSans-Italic.ttf
font-bold-italic = fonts/AcmeSans-BoldItalic.ttf
heading-color = #0B3D91
link-color = #0B6E4F
accent-color = #F2A900
header-left = {logo}
header-right = {title}
footer-left = {author}
footer-right = {date}
logo = acme-logo.svg
cover = yesrayomd --export report.md report.pdf modern --theme=acme.theme --page-numbers| Key | Value |
|---|---|
font |
A TrueType or OpenType font (.ttf, .otf, or the first face of a .ttc) for all text, embedded as a subset |
font-bold, font-italic, font-bold-italic (since 4.5)
|
Optional faces of the same family; each needs font. With a bold face, headings, bold text, table header rows, the table of contents' top level, alert titles and quote headings use it. Bold italic without its own face takes the bold face slanted, else the italic face drawn bold; italic without a face is the regular font slanted, and bold without one is drawn from the regular font |
heading-color, link-color, accent-color
|
#RRGGBB or #RGB; the accent colours rules and the bar beside block quotes |
header-left, header-center, header-right, footer-left, footer-center, footer-right
|
Text in the top and bottom margin of every page, cut short with an ellipsis when it does not fit |
logo |
A PNG, JPEG or SVG image, for {logo} and the cover |
cover |
yes or no: a first page with the logo, title, subject, author and date |
Header and footer text can hold {title}, {author}, {subject}, {date} (from the YAML
front matter; the title falls back to the first heading), {page} and {pages}. A field that
is just {logo} shows the logo. With --page-numbers and no footer-center, the footer centre
shows {page} / {pages}. With a cover, {page} and {pages} count the pages after it.
Paths are relative to the theme file. Lines starting with # or ; are comments, and values
may be quoted. An unknown key, a malformed colour, an unreadable theme file, or font-bold,
font-italic or font-bold-italic without font is an argument error (exit code 2); a font
that cannot be read is exit code 17, and the CLI lists every font path of the theme.
Without a theme, PDFs keep their exact bytes, and a theme with only font writes the same bytes
as before 4.5. In the C++ API a theme is
PdfOptions::theme (PdfTheme); colours there are 0xRRGGBB.