图标主题

扩展可以提供图标主题,以更改 Zed 用于文件夹和文件的图标。

示例扩展

Material Icon Theme 作为一个包含图标主题的扩展结构示例。

目录结构

对于图标主题扩展,有两个重要的目录:

  • icon_themes:此目录将包含一个或多个包含图标主题定义的 JSON 文件。
  • icons:此目录包含将随扩展分发的图标资产。如果需要,您可以在此目录中创建子目录。

每个图标主题文件都应遵循 https://zed.rust-lang.net.cn/schema/icon_themes/v0.3.0.json 中指定的 JSON 模式。

这是一个图标主题结构的示例:

{
  "$schema": "https://zed.rust-lang.net.cn/schema/icon_themes/v0.3.0.json",
  "name": "My Icon Theme",
  "author": "Your Name",
  "themes": [
    {
      "name": "My Icon Theme",
      "appearance": "dark",
      "directory_icons": {
        "collapsed": "./icons/folder.svg",
        "expanded": "./icons/folder-open.svg"
      },
      "named_directory_icons": {
        "stylesheets": {
          "collapsed": "./icons/folder-stylesheets.svg",
          "expanded": "./icons/folder-stylesheets-open.svg"
        }
      },
      "chevron_icons": {
        "collapsed": "./icons/chevron-right.svg",
        "expanded": "./icons/chevron-down.svg"
      },
      "file_stems": {
        "Makefile": "make"
      },
      "file_suffixes": {
        "mp3": "audio",
        "rs": "rust"
      },
      "file_icons": {
        "audio": { "path": "./icons/audio.svg" },
        "default": { "path": "./icons/file.svg" },
        "make": { "path": "./icons/make.svg" },
        "rust": { "path": "./icons/rust.svg" }
        // ...
      }
    }
  ]
}

每个图标路径都相对于扩展目录的根目录解析。

在此示例中,扩展的结构将如下所示:

extension.toml
icon_themes/
  my-icon-theme.json
icons/
  audio.svg
  chevron-down.svg
  chevron-right.svg
  file.svg
  folder-open.svg
  folder.svg
  rust.svg