Brand and appearance
A site starts to look like your own once it carries your name, your logo and
your color. All three are settings in hugo.yml, so a first pass at a brand is
one edit and a reload:
Fonts, the overall look and the footer are settings too. For anything a
setting cannot reach, write plain CSS in
assets/css/project.css, which loads after the theme’s stylesheet.
Leave the theme’s own files alone, because the next hugo mod get replaces
them.
Site name
The site name appears in the navbar, the browser tab and the footer. On a
multilingual site, give each language its own under languages.<lang>.title;
the top-level title is the fallback for a language that sets none.
Logo and wordmark
Out of the box the navbar shows the theme’s mark, assets/icons/logo.svg,
beside the site name. Replace either half by putting an image in the site’s
assets/ or static/ directory and naming its path relative to that
directory:
params.logois the square mark in the navbar, the sidebar header and the footer. A file underassets/goes through Hugo’s resource pipeline; a file understatic/is published unchanged.params.wordmarkis an image of the name that takes the place of the site name text next to the mark. The navbar draws it 16px tall and, like the site name, hides it below 992px, leaving the mark alone, so the wordmark should contain the name only. The footer shows it on its own unless the footer data names a logo.
Crop the SVG tightly around the artwork and give it a viewBox, or it will not
line up with the text beside it. The theme places both images with <img>,
which page CSS cannot recolor and in which currentColor resolves to black.
Choose colors that read on both the light and the dark canvas, or do what the
theme’s own mark does: put a <style> inside the SVG with a
@media (prefers-color-scheme: dark) rule. That rule follows the reader’s
system setting, not the site’s light/dark toggle.
Favicon
There is no favicon setting. The theme looks in the site’s static/ directory
for the conventional file names and adds a <link> to every page for each one
it finds:
favicon.ico, favicon.svg and apple-touch-icon.png are enough for every
browser. A file with a size in its name must be square (NxN); the theme
ignores any other.
Other head metadata, such as a Web App Manifest, goes in
layouts/_partials/hooks/head-end.html. To look in another directory or
accept other names, override layouts/_partials/favicons.html in the site.
Accent color
The accent color marks where the reader is: the selected sidebar row and hover backgrounds, the outline’s current-section marker and its rail, tag and chip hovers, card borders and share buttons on hover, text selection, focus rings, and each section’s mark in the sidebar switcher. Set it with one hex value:
It is most useful per section. Put the pair in a section root’s cascade and
the whole section, its index page included, takes that color, so readers can
tell Docs from Blog at a glance while the rest of the site keeps the default:
Prose links, external URLs and inline code keep the preset’s colors in every section, because a reader should recognize a link or an identifier the same way everywhere. To change those, override the palette.
theme_color_dark is optional. Without it, the theme lightens the light color
toward white until it reaches AA contrast for body text on the dark canvas;
set it yourself when the derived shade drifts from your brand. The light color
is required: a theme_color_dark on its own, or next to an invalid
theme_color, is ignored with a warning, so a page is colored in both modes or
in neither.
To return one page to the default palette, set theme_color: false in its
front matter; that drops the inherited dark color too, without a warning. Any
other value that is not a #rgb or #rrggbb hex, such as a number, true or
a color name, warns and keeps the default. Hugo merges parameters key by key,
so a page that overrides only theme_color still inherits the section’s
theme_color_dark: override both or neither.
The theme checks each color you write against its own canvases and warns when
contrast falls below 4.5:1, the AA level for body text. The color is still
applied, since a custom canvas or a fixed brand color may justify it, and the
warning carries an ID you can add to Hugo’s ignoreLogs once you have checked
it on the real background. A color that only just passes deserves a second
look on interactive surfaces that use it for text over a 12% wash of itself,
such as a linked badge; pick a darker shade if those read poorly.
Fonts
OINK bundles its Latin typefaces as local fonts served from your own site, so no page requests Google Fonts or any other font service. Chinese uses fonts already on the reader’s system, and the theme ships no Chinese font file. Each visual preset arranges the faces its own way:
| Preset | Interface and body text | Headings | Chinese |
|---|---|---|---|
| Paper | IBM Plex Sans | IBM Plex Sans | Hei throughout |
| Slate | Inter | Inter; Chakra Petch for display titles | Hei throughout |
| GitHub | GitHub’s system font stack | GitHub’s system font stack | Hei throughout |
| Ink | Palatino | Palatino; italic for sections | Kai headings and chrome over Fangsong text, or Song where they are missing |
| News | A system serif | Times New Roman, heavy | Song throughout, heaviest in headlines |
| Terminal | IBM Plex Mono, IBM Plex Sans in print | IBM Plex Mono | Hei throughout |
Code is IBM Plex Mono and the wordmark Chakra Petch in Paper and Slate. Plex Sans and Inter include Latin, Cyrillic, Greek and Vietnamese. Chinese emphasis and quotations switch to Kai where the reader has it installed, so Han is never slanted; Terminal colors emphasis instead.
To use the platform’s own fonts and load none of the bundled ones, switch the typography policy:
With system, every role uses the platform font stack. An invalid value warns
and falls back to technical. The policy in effect is written to
<html data-td-typography="…">.
Use fonts readers already have
To change a family without writing CSS, set params.ui.fonts:
Setting ui changes body text and headings in every preset. Set
heading to choose a separate face for headings. The other keys are listed under
Font roles.
These values are family names, not files: the theme never downloads or loads a
font because of this key. A family must already be on the reader’s system or
declared by your own @font-face, so end every list with a
generic family (sans-serif, serif, monospace) for readers who have
neither.
A value may contain only font family syntax: quoted names, bare identifiers,
a leading hyphen as in -apple-system, and names in any script (苹方 is a
family name). Semicolons, braces, parentheses, url() and angle brackets are
rejected. An unknown role or an unsafe value warns and drops that one entry;
the rest of the map still applies. The theme writes these values after its
stylesheet, so they win over both the preset and typography: system.
Bundle your own font
To ship a font file, or to give one kind of content its own face, use the
project stylesheet. Put the .woff2 file in the site’s static/webfonts/,
declare it, and point the roles at it:
Roles are ordinary inherited custom properties, so scoping one to a body class changes the face for that kind of page without touching component selectors:
A monospace stack needs a CJK fallback, or code that mixes Latin and Chinese stops aligning:
Font roles
Eight CSS custom properties carry the font roles, and each can also be set by
its key under params.ui.fonts:
| Property | Config key | Where it is used |
|---|---|---|
--td-ui-font-family |
ui |
Navigation, controls and interface text |
--td-body-font-family |
body |
Body text and blog posts |
--td-heading-font-family |
heading |
Headings in the body |
--td-code-font-family |
code |
Code and terminals |
--td-display-font-family |
display |
Display headings |
--td-meta-font-family |
meta |
Technical labels and metadata |
--td-brand-font-family |
brand |
Wordmark |
--td-print-font-family |
print |
Print body text; follows body unless set |
Visual presets
A preset is a complete look: palette, fonts, link style and table style, in light and dark. Pick the one closest to your brand before adjusting colors by hand.
| Preset | Look |
|---|---|
paper (default) |
Warm paper, ink text, blue links and accent, Plex Sans and framed tables |
slate |
A cool blue-gray technical look |
github (experimental) |
Markdown as GitHub shows a README: GitHub’s fonts and colors, ruled tables, alert colors and green buttons |
ink (experimental) |
A written page on warm paper, Palatino and Kai throughout the chrome and headings, Fangsong or Song text, vermilion marks (emphasis dots, a first letter, the current row), brush-stroke rules and underlined prose links; at night gold and silver writing on indigo-violet paper |
news (experimental) |
A printed page on grey newsprint: heavy Times New Roman and Song headlines, serif text and chrome, one spot blue, a masthead rule, a deck and dateline under the title, thick-and-thin section rules, pull quotes and open tables; at night a darkroom, silver type on black with a safelight orange |
terminal (experimental) |
Monospace controls, headings and prose, teal links, amber accents and compact desktop navigation; at night a phosphor screen, grey type on black with green headings, links and cursor |
Each preset’s dark mode keeps the fonts of its light mode but has a palette of its own, so switching to dark is a different experience rather than an inverted page.
params.ui.preset sets the site’s look. params.ui.preset_menu decides
whether readers may choose another in the Appearance menu:
preset_menu |
Readers can choose |
|---|---|
false (default) |
Nothing; every page uses preset |
true |
Paper, Slate and the site’s own preset |
| A list | Exactly the listed presets; the site’s preset is added with a warning if missing |
GitHub, Ink, News and Terminal appear only when you name them, as
preset or in the list. The menu always lists them in the order of the table
above.
The experiment record
lists what has been tested on Ink and Terminal. A reader’s style and light/dark choice are
saved separately in the browser, and choosing the entry marked as the site
default goes back to following the site. Print always uses a light palette on
white paper.
Font settings and theme_color win in every preset. Dark palette overrides in
your own CSS do not automatically: Paper scopes its dark palette to
[data-td-preset='paper'][data-bs-theme='dark'], which outranks a bare
[data-bs-theme='dark']. Write dark overrides as shown under
Palette colors.
Light and dark mode
Sites are light-only until you turn dark mode on:
This adds the dark palette and a Light / Dark / System choice to the
Appearance control in the navbar and footer, whose icon shows the reader’s
choice: a sun for Light, a moon for Dark, and a half-filled circle for System,
which stays while the system switches between modes. The control works with touch and keyboard and opens as a bottom
sheet on phones. A reader’s choice is saved in the browser and shared across
tabs; with no saved choice the page follows the system’s
prefers-color-scheme. A small inline script applies the mode before the
stylesheet loads, so pages never flash the wrong palette.
To support the dark palette for readers whose system asks for it, without
showing the control, write dark_mode: { enable: true, show_menu: false }.
If preset_menu still offers styles, the control stays and shows a palette.
Footer
footer_style |
Footer |
|---|---|
fat (default) |
A grid of link columns above the copyright line |
slim |
The copyright line only |
none |
No footer |
The link columns come from data/footer/<language>.yaml, described in
Navigation and menus. Until that file
exists, a fat footer renders as slim, so you can switch it on before you
write the links. Front matter, or a section’s cascade, can set a different
style (for example, slim on a focused reading section while keeping fat
elsewhere). An unknown value warns and uses fat.
params.copyright is either a Markdown string or a map of authors,
from_year and to_year, where present means the current year.
footer_center_info is inline Markdown for the middle of the copyright line;
set it to an empty string to leave that space blank.
Project stylesheet
Anything the settings above cannot reach is plain CSS in the site’s
assets/css/:
| File | Use |
|---|---|
project.css |
Your selectors and custom property overrides |
project/*.css |
Optional further files, appended to project.css in path order |
The theme publishes them as one stylesheet that loads after its own, minified, fingerprinted and with an integrity attribute in production. Because it is a separate file, editing your styles leaves the theme’s stylesheet, and the copy in readers’ caches, untouched.
Hugo minifies this file but does not compile it, so write CSS, not SCSS:
// comments, Sass variables, mixins, @extend and &-suffix selectors do not
work, and native CSS nesting reaches the browser as written. Relative URLs
resolve from /css/, so ../webfonts/my-font.woff2 is the site’s
static/webfonts/my-font.woff2. A site upgraded from an older OINK or from
Docsy may still have files under assets/scss/; the build warns and ignores
them until you convert them as described in
Retired SCSS hooks.
Rely only on the public part of the theme’s CSS: the eight
font roles and the --td-brand-* properties keep their names
and meanings across minor releases. Component aliases such as
--td-asciinema-font-family work only inside their component, and other
variables, such as --td-shell-*, can change in any release. Use a variable
where one exists, and otherwise the narrowest selector that works; overriding
baseof.html to change a color makes every theme upgrade a merge.
To add a third-party stylesheet, copy it into the site and publish it as a
local resource from layouts/_partials/hooks/head-end.html, not with a
<link> in Markdown. Keep stylesheets and fonts local rather than pointing at
a CDN, so the site keeps working when that host does not.
Palette colors
Colors other than the accent are CSS custom properties that you override in the project stylesheet. Each preset sets them in light and dark, so override both modes together, or one mode keeps the preset’s color.
Links use Bootstrap’s link tokens, --bs-link-color and
--bs-link-hover-color with their -rgb twins. Bootstrap components such as
buttons use the semantic colors; override the property, and the button
variables that hold the color as a fixed value:
The theme’s brand layer works the same way. Write the dark block with both selectors below: the bare one covers Slate, and the preset-scoped one is needed to outrank Paper’s dark palette.
| Property | Used for |
|---|---|
--td-brand-copper, --td-brand-copper-dim |
A warm secondary accent, used in the footer and Landing sections, and its muted form |
--td-brand-mark-from, --td-brand-mark-to, --td-brand-mark-gradient |
The brand gradient, for example on the site name in the navbar |
--td-brand-header-bg |
Navbar background |
--td-brand-elev |
Overlay backgrounds |
--td-brand-silk |
Secondary text |
--td-brand-line-strong |
Strong rules |
--td-brand-shadow-sm, --td-brand-shadow-md |
Shadows |
Whatever you recolor, check hover, focus, disabled and selected states in both modes: body text needs 4.5:1 contrast and large text 3:1.
Styles for a site-owned shell
A page with its own layout, such as a hand-built home page, can use parts of
the theme’s styling without the reading shell. Instead of main, the
stylesheet every OINK page loads, such a layout asks for a smaller stylesheet
by name:
The partial returns a Hugo resource published as css/<name>.css, one
directory below the site root, where its ../webfonts/… references resolve;
your layout minifies and fingerprints it. An unknown name warns. These
stylesheets follow the pinned theme version, so ask for them by name rather
than copying them into the site, and do not read the layer files under the
theme’s assets/css/td/, which can change in any release.
Verify
- The build ends with
Total in …and reports no ERROR. Read any warnings: a rejected color, font value or preset name is reported there and replaced by the default. - The navbar shows your logo and site name, the browser tab shows your favicon, and switching language switches the site name.
<html>carries thedata-td-typographyanddata-td-presetvalues you set.- In dark mode, body text, tables, callouts, code blocks and focus rings are still readable. Check every color change in both modes and in each preset you offer.
- In the browser’s developer tools, a paragraph’s
font-familylists your family, and the rendered font is the file or system font you expect.
Related
- Configuration — types and defaults of the brand settings
- Navigation and menus — navbar menu, page actions and footer data
- Layouts and page types — shells, sidebar, table of contents and page width
- Images — images in the body, light/dark pairs and captions
- Home and landing pages — hero, sections and landing data