T1: bundle IBM Plex Mono as the code font, italic comments (D28)

Daniel chose IBM Plex Mono from Amy's comparison of four free fonts. It
ships from @fontsource (Latin and Latin Extended, 400/700 with italics)
and leads font-mono for the editor and the terminal; the UI keeps the
system font. OFL-1.1 is allowed for this one package only
(PACKAGE_EXCEPTIONS in xtask/src/licences.rs, comment in deny.toml).
NOTICE, ASSETS.md and docs/themes.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-06 19:16:10 +01:00
parent d81c943905
commit f2a1ef12cd
13 changed files with 70 additions and 17 deletions

View file

@ -1,6 +1,6 @@
# Themes
> **Status:** six built-in themes, theme files with import, editor font settings (C9 T1) · **Last updated:** 2026-11-02
> **Status:** six built-in themes, theme files with import, editor font settings, bundled code font IBM Plex Mono (C9 T1) · **Last updated:** 2026-11-06
Every colour and font in Lutra comes from theme tokens: CSS custom properties `--lt-<name>` that `crates/engine/src/theme.rs` defines and the UI reads with `var(--lt-…)`. Nothing in the UI hard-codes a colour.
@ -30,7 +30,7 @@ The **Editor** section of the settings has three font settings. They apply live
| Setting | Default | Meaning |
|---|---|---|
| `editor.fontFamily` | empty | A CSS font list such as `"JetBrains Mono", monospace`. Empty uses Lutra's monospace stack (`ui-monospace, "Cascadia Code", Menlo, Consolas, monospace`), which also stays behind your choice as a fallback. The font must be installed. The characters `; { } < > \` are refused. Applies to the editor and other code text at once, and to terminals opened afterwards (it drives `--lt-font-mono`). |
| `editor.fontFamily` | empty | A CSS font list such as `"Fira Code", monospace`. Empty uses Lutra's own code font, IBM Plex Mono, which ships with Lutra (regular, bold and italic; comments are set in its italic). The default stack (`"IBM Plex Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace`) also stays behind your choice as a fallback. Any other font must be installed. The characters `; { } < > \` are refused. Applies to the editor and other code text at once, and to terminals opened afterwards (it drives `--lt-font-mono`). |
| `editor.fontSize` | 14 | Size in pixels, 8 to 48. |
| `editor.lineHeight` | 150 | Line height in percent of the font size, 100 to 300. |
@ -149,10 +149,11 @@ Lutra does not check the contrast of an imported theme. To check it the way the
- A built-in theme is a `Theme` constant in `crates/engine/src/theme.rs`, listed in `BUILTIN`, with its name in `ui/src/i18n/en.json` (`theme.<camelId>` and `settings.appearance.theme.value.<camelId>`).
- Every built-in theme defines exactly the tokens of `DARK` (a Rust test checks it). After changing a token, run the engine tests with `LUTRA_UPDATE_SNAPSHOTS=1` to rewrite `ui/tests/theme/themes.json`. The Vitest contrast test reads that file.
- A new token needs a value in every theme, a row above, and a contrast pair in `contrast.test.ts` if text or marks are drawn with it.
- Bundling JetBrains Mono as the default (waiting for the owner to approve OFL-1.1 in `xtask/src/licences.rs` and `deny.toml`) takes three steps: add `@fontsource/jetbrains-mono` to `ui/package.json` and import it in `ui/src/main.ts`; put `"JetBrains Mono"` first in `font-mono` (`COMMON` in `theme.rs`) and in `MONO_FALLBACK` (`ui/src/stores/settings.ts`); then update the default described above.
- The code font IBM Plex Mono comes from `@fontsource/ibm-plex-mono` (Latin and Latin Extended, 400 and 700 with italics, about 118 KB), imported in `ui/src/main.ts`, and leads `font-mono` (`COMMON` in `theme.rs`) and `MONO_FALLBACK` (`ui/src/stores/settings.ts`). Daniel chose it from four candidates Amy compared (D28); OFL-1.1 is allowed for this package only (`PACKAGE_EXCEPTIONS` in `xtask/src/licences.rs`, comment in `deny.toml`). The UI font stays the system font.
## Revision history
| Date | Change | Summary |
|---|---|---|
| 2026-11-06 | minor | IBM Plex Mono bundled as the code font, italic comments (D28) |
| 2026-11-02 | major | First version: four new built-in themes, theme file format and import, editor font settings (C9 T1) |