Start from Paligo Base
Paligo Base is a complete theme, written to be changed. Download it, as described in Download a theme, and change as much or as little as you want: its colors and fonts, its templates, or all of it. This topic describes how it is built, so that you know where to make a change.
Where things are
File | Contains |
|---|---|
| The page frame for every page: the header, the navigation sidebar and the footer. Read it first. |
| Topic pages: the breadcrumb trail, the content, the previous and next links, and the on-page table of contents. |
| The portal page: the banner, the featured topics and the list of topics. |
| The search results page. |
| The logo and site title, the portal banner, the search box and the light and dark mode button. |
| All of the theme's styles. Its first section sets the colors, fonts and sizes. |
| Styles for the output of the |
| Code colors, used when the layout's Code colours is Theme colours. |
| Scripts for the navigation sidebar, the on-page table of contents, the light and dark mode button and the portal. |
| The theme's own texts, in English. |
| A short introduction to the theme. |
| Instructions for AI coding assistants. See Build a theme with an AI coding assistant. |
| Points Claude Code to |
Change colors, fonts and sizes
Most changes only need the CSS custom properties at the top of assets/css/main.css. Every color, font and size in the theme comes from them:
Property | Controls |
|---|---|
| Links, buttons and highlights. The Accent color option sets these. |
| The two colors of the gradient on the built-in logo mark and the current navigation item. |
| The page background, and the background of the sidebar, code blocks and admonitions. |
| Text colors, from strongest to faintest. |
| Borders. |
| The color of each type of admonition. |
| The text font and the code font. |
| The size and line spacing of text. |
| Rounded corners. |
| The height of the header, the widths of the sidebar and the on-page table of contents, and the greatest width of the page. |
| Code colors, when Code colours is Theme colours. They are in |
:root {
--paligo-primary: #0b7a75;
--paligo-primary-hover: #075955;
--paligo-font: "Source Sans 3", system-ui, sans-serif;
}Note
Paligo Base loads the Inter font from Google Fonts. To serve your own font instead, add it to assets/fonts/ as a WOFF2 file, declare it with @font-face, change --paligo-font, and remove the @import of Google Fonts at the top of main.css.
Light and dark mode
Paligo Base follows the reader's light or dark setting, and readers can switch with the button in the header. The dark colors are a second set of the same properties, in main.css under @media (prefers-color-scheme: dark) and :root[data-theme="dark"]. If you change a color, change it in both sets.
When a reader selects the button, the <html> element gets data-theme="light" or data-theme="dark", and the browser remembers the choice.
Change the page structure
base.html.twig is divided into Twig blocks, which the other templates replace where they need to. To change one part of every page, edit that block in base.html.twig:
Block | Contains |
|---|---|
| The header and the navigation sidebar together. |
| The menu button for the sidebar on small screens. |
| The search box in the header. |
| The language menu and the light and dark mode button. |
| The breadcrumb trail. |
| The navigation sidebar. |
| The main area of the page. |
| The content inside the main area. |
| The page title in the browser tab. |
| Classes on the |
Keep {{ paligo.head }} and {{ paligo.foot }} in base.html.twig, and keep your stylesheets after {{ paligo.head }}, so that your styles take priority over Paligo's.
Style your content
Paligo writes the HTML for your content, and gives it these classes:
Content | Classes |
|---|---|
Admonitions |
|
Figures |
|
Tables |
|
Code |
|
Accordions |
|
Glossary terms |
|
Interface names and keys |
|
Untranslated text in a draft |
|
Paligo's own stylesheet styles these, and main.css styles them again. To change them, change the rules in main.css.
Right-to-left languages
Paligo Base sets dir="rtl" on pages in right-to-left languages, but its stylesheet isn't mirrored for them. If you publish in Arabic or Hebrew, check every page type and add the rules you need, such as for [dir="rtl"] .site-nav.
Keep it working with Paligo
Keep the
site-search__…class names if you change the search box. See Search in a theme.Keep an option's
keyintheme.jsonwhen you change the option. Layouts store their values by key, so renaming a key loses the value set for it on every layout.Check the theme in light and dark mode, and on a topic page, the portal page and the search page.