On this page
Themes & Icons
#Light and dark
Clay has a light and a dark theme. It starts with the reader’s system setting and switches along when the system does. The sun or moon button in the navbar switches by hand; the choice is remembered in the browser and applied before the page is drawn, so pages never flash in the wrong theme.
Code blocks are highlighted in two color schemes and switch together with the site.
#Your own colors and fonts
theme in clay.yaml gives the site your own look. Everything you leave out keeps Clay’s:
theme:
primary: "#2563eb" # links, buttons, the marks in the navigation
radius: "0.25rem" # corners of boxes; fields get half of it
font: "Lora, serif" # the text
codeFont: "JetBrains Mono, monospace"
dark:
primary: "#60a5fa" # light and dark can differ
background: "#0b1120"
text: "#e2e8f0"| Setting | What it changes |
|---|---|
primary |
Links, buttons, the active entry in the sidebar and the contents |
background, text |
The page and its text; boxes and borders are derived from the background |
radius |
The corners of boxes, code blocks and buttons, e.g. 0 for square |
font, codeFont |
The fonts of the text and of code |
windowDots |
false takes the window’s three buttons off shell code, also in code groups |
light, dark |
primary, background and text for one mode only |
Colors are written as #rrggbb or #rgb. Text on the primary color turns black or white, whichever reads better. Social images take the colors of the dark mode and the font.
Fonts from Google Fonts are downloaded when the site is built and published with it: readers get them without having them installed, and their browsers never contact Google. Other fonts, like Georgia or Helvetica, are used when the reader has them, otherwise the next font in the list.
Tip
Keep enough contrast between text and background, at least 4.5 to 1, so everyone can read your docs. Check your colors with a contrast checker.
#Icons
Clay uses Font Awesome for icons: pages, folders, the start page and navbar links. Write the icon’s classes, as shown on the icon’s page on fontawesome.com:
icon: fa-solid fa-rocket| Style | Example |
|---|---|
| Solid | fa-solid fa-rocket |
| Regular | fa-regular fa-file |
| Brands | fa-brands fa-github |
Icons work in Markdown too, as HTML: <i class="fa-solid fa-star"></i> gives .
#Free icons
Without further setup, Clay loads the free icons of Font Awesome 6. They cover the solid, regular and brands styles, enough for most docs.
#Font Awesome kits
With a Font Awesome account, you can create a kit: a set of icons that can include Pro icons, newer versions or your own uploads. With a kit, Clay loads the kit instead of the free icons.
Create a kit on fontawesome.com and set its technology to Web Fonts. Kits set to SVG replace each icon in the page with a drawing, which interferes with how Clay updates pages while readers navigate.
Allow your site’s domain in the kit’s settings.
Set the kit’s ID in
clay.yaml. The ID is the code in the kit’s embed URL,https://kit.fontawesome.com/abc123def4.js:clay.yamlfontawesomeKit: "abc123def4"
Tip
Kits are tied to your account. Keep the ID out of a public repository by setting it in CI with CLAY_FONTAWESOME_KIT, as this site does; see environment variables. A value that is not a kit ID falls back to the free icons.