1# Zed Theme Importer
2
3---
4
5## Usage
6
7- `cargo run -p theme_importer` - Import the context of `assets/themes/src`
8
9---
10
11## Troubleshooting
12
13As the importer generates rust files, you may need to manually do some cleanup in `registry.rs` and `themes/mod.rs` if you remove themes or delete the `themes` folder in the theme crate.
14
15---
16
17## Required Structure
18
19To import a theme or series of themes 3 things are required:
20
21- `family.json`: A JSON file containing the theme family metadata and list of theme variants
22- `{theme_name}.json`: One theme json for each theme variant
23- `LICENSE`: A license file for the theme family
24
25### `family.json`
26
27#### `name`
28
29The name of the theme family. Avoid special characters.
30
31This will be used for the theme family directory name (lowercased) and the theme family name in the Zed UI.
32
33Good:
34
35- `Rose Pine`
36- `Synthwave 84`
37- `Monokai Solarized`
38
39Bad:
40
41- `Rosé Pine`
42- `Synthwave '84`
43- `Monokai (Solarized)`
44
45#### `author`
46
47The author of the theme family. This can be a name or a username.
48
49This will be used for the theme family author in the Zed UI.
50
51#### `themes`
52
53A list of theme variants.
54
55`appearance` can be either `light` or `dark`. This will impact which default fallback colors are used, and where the theme shows up in the Zed UI.
56
57### `{theme_name}.json`
58
59Each theme added to the family must have a corresponding JSON file. This JSON file can be obtained from the VSCode extensions folder (once you have installed it.) This is usually located at `~/.vscode/extensions` (on macOS).
60
61You can use `open ~/.vscode/extensions` to open the folder in Finder directly.
62
63Copy that json file into the theme family directory and tidy up the filenames as needed.
64
65### `LICENSE`
66
67A LICENSE file is required to import a theme family. Failing to provide a complete text license will cause it to be skipped when the import is run.
68
69If the theme only provices a license code (e.g. MIT, Apache 2.0, etc.) then put that code into the LICENSE file.
70
71If no license is provided, either contact the theme creator or don't add the theme.
72
73---
74
75### Complete Example:
76
77An example family with multiple variants:
78
79```json
80{
81 "name": "Ayu",
82 // When both name and username are available
83 // prefer the `username (name)` format
84 "author": "dempfi (Ike Ku)",
85 "themes": [
86 {
87 "name": "Ayu Light",
88 "file_name": "ayu-light.json",
89 "appearance": "light"
90 },
91 {
92 "name": "Ayu Mirage",
93 "file_name": "ayu-mirage.json",
94 "appearance": "dark"
95 },
96 {
97 "name": "Ayu Dark",
98 "file_name": "ayu-dark.json",
99 "appearance": "dark"
100 }
101 ]
102}
103```
104
105An example single variant family:
106
107```json
108{
109 "name": "Andromeda",
110 "author": "Eliver Lara (EliverLara)",
111 "themes": [
112 {
113 "name": "Andromeda",
114 "file_name": "andromeda.json",
115 "appearance": "dark"
116 },
117 {
118 "name": "Andromeda Bordered",
119 "file_name": "andromeda-bordered.json",
120 "appearance": "dark"
121 }
122 ]
123}
124```