# Labels and styles

## Labels

`labels` replaces any of the words charon writes around a page. Set `lang`
beside it, for the `lang` attribute and the date format:

```json
{
  "lang": "ja",
  "labels": {
    "onThisPage": "このページ",
    "previous": "← 前へ",
    "next": "次へ →",
    "results": "{count} 件"
  }
}
```

`{heading}` and `{count}` are filled in:

| Key                         | Default                                           |
| --------------------------- | ------------------------------------------------- |
| `docs`                      | `Docs`, the sidebar's label                       |
| `menu`                      | `Docs menu`                                       |
| `moreDocs`                  | `More docs`, the previous and next links' label   |
| `onThisPage`                | `On this page`                                    |
| `previous`, `next`          | `← Previous`, `Next →`                            |
| `lastUpdated`               | `Last updated`                                    |
| `viewMarkdown`              | `View as Markdown`                                |
| `linkTo`                    | `Link to {heading}`                               |
| `search`, `searchDocs`      | `Search`, `Search docs`                           |
| `navigate`, `open`, `close` | `navigate`, `open`, `close`: the search key hints |
| `oneResult`, `results`      | `1 result`, `{count} results`                     |
| `noMatches`                 | `No matches found.`                               |
| `searchFailed`              | `Search failed. Try again in a moment.`           |

`DEFAULT_LABELS` from `@memomori/charon/docs/labels` holds them all.

## Styles

`docs-site.css` is the whole default theme: charon's page styles, the module
styles, `docs.css` and `docs-layout.css`.

- `docs.css` styles the title row, the sidebar, "On this page", previous and
  next, and the search dialog, all from the `--charon-*`
  [tokens](../styles.md#colors).
- `docs-layout.css` lays out the three columns and sets the font.
- `fonts.css` declares JetBrains Mono, which charon ships.

Change colors through the tokens, as on any charon page. The search dialog
takes four tokens of its own, each with a fallback:

| Token                          | Used for                 | Fallback                          |
| ------------------------------ | ------------------------ | --------------------------------- |
| `--charon-docs-surface`        | dialog background        | `Canvas`                          |
| `--charon-docs-surface-subtle` | dialog footer            | `--charon-code-inline-background` |
| `--charon-docs-faint`          | icons and secondary text | `--charon-captions`               |
| `--charon-docs-highlight`      | matched words            | a pale yellow                     |

To restyle the CLI's site, give it a [template](template.md) that links your
own stylesheet after `_charon/docs.css`.

## Font

The default theme sets every page, code included, in JetBrains Mono. Charon
ships the font: four variable WOFF2 files, Latin and Latin Extended, upright
and italic, about 115 KB in all. A browser fetches only the ones a page uses,
so readers load nothing from a font host. Code turns off the font's ligatures,
so `==`, `~~` and `->` show as typed.

- `charon build` writes them to `_charon/fonts/`.
- The Vite plugin bundles them like any other asset.

To use another font, set `--charon-docs-font` in your own stylesheet. With the
CLI, link that stylesheet from a [template](template.md):

```css
:root {
  --charon-docs-font: 'Inter', system-ui, sans-serif;
}
```

To use JetBrains Mono in your own template, import
`@memomori/charon/fonts.css` and set `font-family: 'JetBrains Mono'`.

JetBrains Mono is under the SIL Open Font License 1.1; the package's
`THIRD-PARTY-NOTICES` holds the text.
