Custom Icons in Snippets panel

Categories:Blog

The Snippets panel does a great job at organising your JSFL scripts, but there's still a few things incomplete and/or missing.

File-based icons

One of these things is custom icons. Whilst the supplied FamFam icon set is pretty good, often there's no icon that's "just right". The solution to this up until now has been to simply supply an alternative URL:

/**
 * My awesome snippet
 * @icon {user}assets/icons/awesome.png
 */

This is great when you're just using the snippet yourself, but not so convenient when you need to distribute scripts amongst your co-workers or such like.

Text-based icons

The next release of the Snippets panel supports encoding of icon data into the snippet DocComment itself, by way of a Base64-encoded string.

/**
 * This file demonstrates using a custom icon
 * @icon data:AAAAAAAAAAAAAAAAggAAAKoAAAAqAAAAAAAAAAAAAAAAAAAAAAAAACoAAACrAAAAggAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG4AAACAAAAAKgAAAAAAAAAAAAAAAAAAAAAAAAArAAAAgQAAAG4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKwAAAKgAAAB8AAAAAAAAAAAAAAB9AAAAqQAAACsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAAACpAAAAfQAAAAAAAAAAAAAAfQAAAKoAAAArAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIUAAACuAAAAqgAAAKgAAACmAAAApwAAAKgAAACrAAAArwAAAIYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACGAAAAsAAAAKwAAACpAAAApwAAAKgAAACqAAAArQAAALAAAACHAAAAAAAAAAAAAAAAAAAAAAAAAHEAAAC5AAAAtQAAAFkAAAAAAAAAfwAAAKgAAACpAAAAgAAAAAAAAABaAAAAtgAAALkAAABxAAAAAAAAAAAAAAByAAAAuwAAALYAAABaAAAAAAAAAIEAAACqAAAAqwAAAIEAAAAAAAAAWgAAALcAAAC7AAAAcgAAAAAAAADDAAAAwAAAAL0AAAC4AAAAtAAAALAAAACtAAAAqwAAAKwAAACuAAAAsQAAALUAAAC5AAAAvQAAAMAAAADDAAAAxQAAAKoAAACOAAAAogAAALUAAACyAAAArwAAAK0AAACuAAAAsAAAALMAAAC2AAAAogAAAI4AAACqAAAAxQAAAMYAAABiAAAAAAAAAIwAAAC3AAAAswAAALAAAACuAAAArwAAALEAAAC0AAAAuAAAAI0AAAAAAAAAYgAAAMYAAADIAAAAYwAAAAAAAACNAAAAuAAAAC4AAAAAAAAAAAAAAAAAAAAAAAAALgAAALkAAACOAAAAAAAAAGMAAADIAAAAAAAAAAAAAAAAAAAAjgAAALoAAAAuAAAAAAAAAAAAAAAAAAAAAAAAAC4AAAC7AAAAjwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAvAAAAtwAAAIcAAAAAAAAAAAAAAIgAAAC4AAAALwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAUAAAAKAAAAOQAAALgAAACMAAAAGgAAABoAAACMAAAAuQAAADkAAAAKAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAFAAAACgAAABAAAAAVAAAAGQAAABoAAAAaAAAAGQAAABUAAAAQAAAACgAAAAUAAAABAAAAAAAAAA==
 */

The result of this 1.3K string is a completely custom icon in the Snippets panel, which will go wherever the snippet goes:

The new Snippets panel will also finally have an icon chooser, as well as a conversion tool to convert any image you pick from your hard drive into the Base64-encoded string.

Comments are closed.