Add support for loading user themes (#7027)

This PR adds support for loading user themes in Zed.

Themes are loaded from the `themes` directory under the Zed config:
`~/.config/zed/themes`. This directory should contain JSON files
containing a `ThemeFamilyContent`.

Here's an example of the general structure of a theme family file:

```jsonc
{
  "name": "Vitesse",
  "author": "Anthony Fu",
  "themes": [
    {
      "name": "Vitesse Dark Soft",
      "appearance": "dark",
      "style": {
        "border": "#252525",
        // ...
      }
    }
  ]
}
```

Themes placed in this directory will be loaded and available in the
theme selector.

Release Notes:

- Added support for loading user themes from `~/.config/zed/themes`.
This commit is contained in:
Marshall Bowers 2024-01-29 21:32:45 -05:00 committed by GitHub
parent 5f4dd36a1a
commit 9cb5a84b8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 131 additions and 38 deletions

View file

@ -103,7 +103,7 @@ impl ThemeSelectorDelegate {
let staff_mode = cx.is_staff();
let registry = ThemeRegistry::global(cx);
let mut themes = registry.list(staff_mode).collect::<Vec<_>>();
let mut themes = registry.list(staff_mode);
themes.sort_unstable_by(|a, b| {
a.appearance
.is_light()