← All messages

Icons became resources, and the sprite became one of three

Up to 1.1 the engine itself turned a folder of PNG files into one icons.png sprite. That was one way to draw an icon, built into the core, and an app that wanted sharp icons in the colour of its text had no way around it.

Now an icon is a resource, and there are three. icons/sprite builds the same sprite as before, so an app that names it looks exactly as it did. icons/svg puts every SVG of the folder as a mask in the CSS: the icon takes the colour of the text, so a hover or a dark theme needs no second file, and it stays sharp at any size; it is the one to pick for a new app. icons/font writes the filled shapes of the SVGs as a TrueType font, for the rare place that wants a character.

What stayed in the engine is one hook. A resource names a file in @ build that returns a function; the builder calls it with the icons folders, the www folder and the version of the app, and puts the CSS it returns in the iconNS bundle. The preload of the sprite left view() with it.

Upgrading is one line: an app that sets icons adds icons/sprite to its resources and nothing looks different. One that forgets it builds without icons, and build::lint says why.

We use essential cookies to make this site work. With your permission we also use analytics to improve the site.