fileIcons instead (see the
end of this page): those show whatever icon theme is in use.
Start
icons/theme.json and four SVGs:
The theme file
theme.json maps names to SVG files (paths relative to the package):
Matching:
- Files match by exact name, then the longest extension (
a.test.tstriestest.ts, thents), thenfile. - Folders match by name, then
folder/folderExpanded. Folders with a role (source root, excluded, module) keep their built-in icons. - Names are case-insensitive.
url() or entities.
Optional fields
- Light and dark. An
iconDefinitionsvalue may be{ "light", "dark" }; the dark SVG is used with dark themes. Icon ids may not end in_dark. patternsare regular expressions checked in order, beforefileNamesandfileExtensions.targetisfile(default) orfolder; withpatha pattern matches the whole path (with/separators) instead of the name;ignoreCaseignores case. Patterns that could backtrack badly (a repeated group, too many ways to match one name), lookaround, inline flags and named groups are refused.openIcon(folder patterns) andfolderOpen(other folders) are used for folders that hold a file open in the editor, when the theme’s hollow-folders option is on.overridesreplace built-in IDE icons by name (chevron-right,folder-source, …); symbol icons (symbol-<kind>,class,method, …) are the code element icons.groupsare packs of patterns the user turns on or off;enabledis the default.choicesare variants the user picks one of; the chosen option’soverrideswin over the top-leveloverrides.accent: true: elements withdata-tint="true"take the colour the user picks.- Elements with
data-themed="true"take the accent colour of Settings › Appearance & Behavior › Appearance, or the colour theme’s custom accent.
A settings page
settings describes the theme’s page under Settings › Plugins, named after the theme’s
label. A theme without settings has no page.
title and items. Each item names an option the IDE implements, with
the theme’s label, an optional hint and, where the option needs one, a default:
Values are kept per theme in the
appearance.fileIconThemeOptions setting and apply while
the theme is selected.
Icons for a plugin’s own file types
A plugin that adds a language or file type can ship icons for it without being an icon theme. They show whatever icon theme is in use:.dot files. SVGs are sanitised like icon theme SVGs.
Tips
- Material Icons generates its SVGs and
theme.jsonwith a script (generate.py, not part of the package); for a large theme, generate rather than hand-edit. - Keep icons readable at 16 px and on both light and dark backgrounds, or provide
darkvariants. openidea-plugin checkvalidates the theme file and every SVG as installing would.