[en] Start from Paligo Base
[en] Paligo Base is a complete theme, written to be changed. Download it, as described in [en] 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.
[en] Where things are
[en] File | [en] Contains |
|---|---|
[en] | [en] The page frame for every page: the header, the navigation sidebar and the footer. Read it first. |
[en] | [en] Topic pages: the breadcrumb trail, the content, the previous and next links, and the on-page table of contents. |
[en] | [en] The portal page: the banner, the featured topics and the list of topics. |
[en] | [en] The search results page. |
[en] | [en] The logo and site title, the portal banner, the search box and the light and dark mode button. |
[en] | [en] All of the theme's styles. Its first section sets the colors, fonts and sizes. |
[en] | [en] Styles for the output of the |
[en] | [en] Code colors, used when the layout's Code colours is Theme colours. |
[en] | [en] Scripts for the navigation sidebar, the on-page table of contents, the light and dark mode button and the portal. |
[en] | [en] The theme's own texts, in English. |
[en] | [en] A short introduction to the theme. |
[en] | [en] Instructions for AI coding assistants. See [en] Build a theme with an AI coding assistant. |
[en] | [en] Points Claude Code to |
[en] Change colors, fonts and sizes
[en] 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:
[en] Property | [en] Controls |
|---|---|
[en] | [en] Links, buttons and highlights. The Accent color option sets these. |
[en] | [en] The two colors of the gradient on the built-in logo mark and the current navigation item. |
[en] | [en] The page background, and the background of the sidebar, code blocks and admonitions. |
[en] | [en] Text colors, from strongest to faintest. |
[en] | [en] Borders. |
[en] | [en] The color of each type of admonition. |
[en] | [en] The text font and the code font. |
[en] | [en] The size and line spacing of text. |
[en] | [en] Rounded corners. |
[en] | [en] The height of the header, the widths of the sidebar and the on-page table of contents, and the greatest width of the page. |
[en] | [en] 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;
}Anmerkung
[en] 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.
[en] Light and dark mode
[en] 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.
[en] When a reader selects the button, the <html> element gets data-theme="light" or data-theme="dark", and the browser remembers the choice.
[en] Change the page structure
[en] 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:
[en] Block | [en] Contains |
|---|---|
[en] | [en] The header and the navigation sidebar together. |
[en] | [en] The menu button for the sidebar on small screens. |
[en] | [en] The search box in the header. |
[en] | [en] The language menu and the light and dark mode button. |
[en] | [en] The breadcrumb trail. |
[en] | [en] The navigation sidebar. |
[en] | [en] The main area of the page. |
[en] | [en] The content inside the main area. |
[en] | [en] The page title in the browser tab. |
[en] | [en] Classes on the |
[en] 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.
[en] Style your content
[en] Paligo writes the HTML for your content, and gives it these classes:
[en] Content | [en] Classes |
|---|---|
[en] Admonitions | [en] |
[en] Figures | [en] |
[en] Tables | [en] |
[en] Code | [en] |
[en] Accordions | [en] |
[en] Glossary terms | [en] |
[en] Interface names and keys | [en] |
[en] Untranslated text in a draft | [en] |
[en] Paligo's own stylesheet styles these, and main.css styles them again. To change them, change the rules in main.css.
[en] Right-to-left languages
[en] 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.
[en] Keep it working with Paligo
[en] Keep the
site-search__…class names if you change the search box. See [en] Search in a theme.[en] 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.[en] Check the theme in light and dark mode, and on a topic page, the portal page and the search page.