A complete Acode plugin that registers a file and folder icon pack with acode.require("fileIcons").
Assets come from the Material Icons pack; see LICENSE.
This repository is the standalone example for Acode's icon pack API. It is not part of the Acode app repository.
- Download
plugin.zip(same contents asmaterial-icons.zip). - In Acode, open Plugins → + → Local and pick the zip.
- Select Icon Pack Example in Settings → App settings → Icon pack.
Requires an Acode build that includes the fileIcons plugin API.
Capture acode.require("fileIcons") at the top of main.js, before any await. The loader binds that API to this plugin. After an await, require("fileIcons") has no executing main-script context and throws. You can also take fileIcons from the third initialization argument: (baseUrl, page, { fileIcons }).
The plugin reads bundled JSON maps through acode.require("fs"), converts them into top-level associations, and registers the pack. Image URLs use the initialization callback's baseUrl. Expanded folder icons are declared explicitly. Acode supplies pack ownership from the loading plugin; do not pass pluginId. If you do, it must match this plugin's id.
Registration does not change the selected pack. The returned registration is disposed on unmount; Acode also removes packs owned by the plugin when it unmounts.
Use register again with the complete pack to replace it. There is no separate update or unregister method in the plugin API.
const fileIcons = acode.require("fileIcons");
const fs = acode.require("fs");
const Url = acode.require("Url");
acode.setPluginInit(plugin.id, async (baseUrl) => {
const root = Url.join(PLUGIN_DIR, plugin.id);
const files = await fs(Url.join(root, "file_icons.json")).readFile("json");
const folders = await fs(Url.join(root, "folder_icons.json")).readFile("json");
registration = fileIcons.register({
id: plugin.id,
name: "Icon Pack Example",
icons: `${Url.join(baseUrl, "icons")}/`,
...mapsFromPack(files, folders),
folder: "folder",
folderExpanded: "folder-open",
rootFolder: "folder-root",
rootFolderExpanded: "folder-root-open",
});
});
acode.setPluginUnmount(plugin.id, () => registration?.dispose());Do not load packaged JSON with fetch(). In Acode, the Cordova HTTP-backed fetch() path cannot read plugin files reliably. Use acode.require("fs") with a filesystem path, and baseUrl only for image URLs.
API reference: File and folder icon packs in the Acode repository.
| Path | Role |
|---|---|
main.js |
Loads JSON maps and registers the pack |
plugin.json |
Plugin manifest |
file_icons.json / folder_icons.json |
Association maps from the Material Icons pack |
icons/ |
SVG assets referenced by those maps |
plugin.zip |
Installable plugin archive |
From this directory:
zip -r plugin.zip LICENSE file_icons.json folder_icons.json icon.png icons main.js plugin.json readme.md
cp plugin.zip material-icons.zip- Change
id,name, and author inplugin.jsonandmain.js. - Swap
icons/and the JSON maps, or register associations inline. - Capture
acode.require("fileIcons")at the top ofmain.js, or useoptions.fileIconsinsetPluginInit. OmitpluginId; Acode binds ownership to the loading plugin. - Rebuild
plugin.zipand install it locally.