| 1 |
# Themes |
| 2 |
|
| 3 |
The 31 theme files this crate ships. Consumers get them two ways: as a |
| 4 |
directory via `bundled_themes_dir()`, or embedded with no path at all via |
| 5 |
`embedded_themes()`. |
| 6 |
|
| 7 |
Attribution for the adapted palettes lives in |
| 8 |
[THIRD-PARTY-NOTICES.md](../THIRD-PARTY-NOTICES.md). Each adapted file also |
| 9 |
carries its upstream, license, and copyright line in a header comment, so the |
| 10 |
credit travels with the file if someone copies one out on its own. |
| 11 |
|
| 12 |
## File format |
| 13 |
|
| 14 |
A theme declares colors by intent, not by hue. Sections: |
| 15 |
|
| 16 |
```toml |
| 17 |
[meta] |
| 18 |
name = "Nord" # display name; falls back to the filename |
| 19 |
variant = "dark" # "dark", "light", or "high-contrast" |
| 20 |
|
| 21 |
[surface] # container backgrounds by elevation |
| 22 |
page = "#2e3440" |
| 23 |
raised = "#3b4252" |
| 24 |
sunken = "#434c5e" |
| 25 |
overlay = "#3b4252" |
| 26 |
|
| 27 |
[content] # text and ink by emphasis |
| 28 |
primary = "#d8dee9" |
| 29 |
secondary = "#e5e9f0" |
| 30 |
muted = "#616e88" |
| 31 |
|
| 32 |
[action] # interactive / brand color |
| 33 |
primary = "#81a1c1" |
| 34 |
|
| 35 |
[status] # state semantics |
| 36 |
danger = "#bf616a" |
| 37 |
success = "#a3be8c" |
| 38 |
warning = "#ebcb8b" |
| 39 |
info = "#88c0d0" |
| 40 |
|
| 41 |
[line] |
| 42 |
border = "#4c566a" |
| 43 |
|
| 44 |
[category] # optional; tag and label colors |
| 45 |
``` |
| 46 |
|
| 47 |
Interactive states (hover, active, selection, row striping, contrast pairings) |
| 48 |
are not authored. `resolve()` derives them perceptually in OKLab, so a theme |
| 49 |
file stays small and every consuming app derives them identically. |
| 50 |
|
| 51 |
### Theme ID |
| 52 |
|
| 53 |
The filename without `.toml`. IDs may contain only alphanumeric characters, |
| 54 |
hyphens, and underscores; path traversal characters are rejected. |
| 55 |
|
| 56 |
## Adding a theme |
| 57 |
|
| 58 |
1. Create `your-theme.toml` here. |
| 59 |
2. If it adapts an existing palette, add the header comment naming the upstream |
| 60 |
project, its license, and the exact copyright line from its LICENSE file. |
| 61 |
Verify against the actual LICENSE, not a README or a secondhand claim. |
| 62 |
3. Add a row to [THIRD-PARTY-NOTICES.md](../THIRD-PARTY-NOTICES.md). |
| 63 |
4. Run `cargo test`. The suite fails if a theme is missing from the notices |
| 64 |
file, if an adapted theme has no inline attribution, or if the embedded set |
| 65 |
drifts from this directory. |
| 66 |
|
| 67 |
Original themes (no third-party palette) skip steps 2 and 3, but must be listed |
| 68 |
under "Original themes" in the notices file. |
| 69 |
|
| 70 |
## License |
| 71 |
|
| 72 |
The theme files are MIT, as is the rest of the crate. The underlying palettes |
| 73 |
of adapted themes remain their original authors' work; see |
| 74 |
[THIRD-PARTY-NOTICES.md](../THIRD-PARTY-NOTICES.md). |
| 75 |
|