gfxholo / iconic

Customize your icons and colors directly from the Obsidian UI, including tabs, files, bookmarks, properties, and ribbon commands.
https://obsidian.md/plugins?id=iconic
MIT No Attribution
65 stars 2 forks source link

Expose API for plugins #21

Open KhangHLe opened 2 months ago

KhangHLe commented 2 months ago

Allow us to set icons through the plugin API, my use case would be to have Templater automatically set icons for specific templates. Unless it is already possible, I'd like to know how 😬

gfxholo commented 2 months ago

At the moment, you can just call app.plugins.getPlugin('iconic').saveFileIcon(object, icon, color).

The method expects these parameters:

After that, call getPlugin('iconic').refreshIconManagers() to update the UI. It's not a public API so you shouldn't rely on this code forever, but it works pretty well right now.

I'll think about making this easier to use in the future 💜

KhangHLe commented 2 months ago

Thank you! A simpler suggestion would be to have a setting to apply the current icon on the template file to the note