Styles

Built-in Themes

Theme comes with a set of predefined color schemes, Use BookTheme parameter in your site config:

hugo.toml
[params]
  BookTheme = 'light'  # or 'dark', 'auto'
ThemeDescription
lightDefault. Light background with dark text
darkDark background (Nord palette) with light text
autoSwitches between light and dark based on OS
contrast-lightHigh contrast light variant
contrast-darkHigh contrast dark variant
contrast-autoHigh contrast, auto-switching
catppuccin-lightCatppuccin Latte palette
catppuccin-darkCatppuccin Frappe palette
catppuccin-autoCatppuccin, auto-switching
ayu-lightAyu light palette
ayu-darkAyu mirage dark palette
ayu-autoAyu, auto-switching

The list of themes, except light, dark, and auto is not written in stone and potentially would change in the future.

Custom Theme

A theme is just a block of CSS variables selected by data-theme. You can define your own in assets/styles/custom.css:

assets/styles/custom.css
:root[data-theme="mytheme"] {
  --body-background: #fafafa;
  --body-font-color: #333;
  ...
}

Then set BookTheme = 'mytheme'.

Custom Styles

The file assets/styles/custom.css is loaded last, so it overrides every theme style, in this way you can customize styles without editing Hugo theme sources.

assets/styles/custom.css
.book-page {
  max-width: 60rem;
}

.book-menu nav {
  font-size: 0.9rem;
}

CSS Variables

The theme is driven by CSS variables:

Override any of them in assets/styles/custom.css. To adjust the current theme regardless of which one is active, target :root:

assets/styles/custom.css
:root {
  --menu-width: 18rem;
}

File overrides

Hugo’s lookup order lets you override any theme file by creating the same file in your project:

  • layouts/: Override templates and partials
  • assets/: Override CSS and JavaScript
  • static/: Override static files (favicon, images)
  • i18n/: Override or add translations