入门 Zed Industries 2026-09-14 17:42:20 · 0 阅读
第134章 图标主题(扩展)
扩展可以为 Zed 提供图标主题,用于修改文件和文件夹的图标。
示例扩展
Material Icon Theme 展示了包含图标主题的扩展结构示例。
目录结构
图标主题扩展涉及两个关键目录:
icon_themes:该目录包含一个或多个定义图标主题的 JSON 文件。icons:该目录存放扩展提供的图标资源,可根据需要创建子目录。
每个图标主题文件需遵循指定在 https://zed.dev/schema/icon_themes/v0.3.0.json 的 JSON 架构规范。
以下是一个图标主题结构示例:
{
"$schema": "https://zed.dev/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