Today, we have to maintain three separate sprite sheets with icons manually:
- smallIcons.svg
- toolbarButtonGlyphs.svg
- resourceGlyphs.svg
The biggest downside of such an approach is that adding an icon is a hassle.
One have to find a free space for the icon in the spritesheet, calculate its coordinates,
and then manually declare the icon in UI.Icon.Descriptors map.
Other downsides are:
- it's hard to grow a spritesheet
- it's hard to cleanup the spritesheet of unused icons (there's a helper script for this, but still: https://gist.github.com/aslushnikov/4aa0e0865523db1b72d990c701ce39d4)
- when two different patches add a new icon to the same spritesheet, someone will have to resolve conflict with inkscape.
Ideally, all of our icons should be stored as a separate SVG files. We should have a script which assembles them into a spritesheet and which generates the UI.Icon.Descriptors map.
The upsides of this approach would be:
- no need to manage spritesheet manually
- ability to write a presubmit script which validates that every icon is in use
- ease of adding a new icon: just drop the icon svg in the icons/ folder
- no icon-related merge conflicts
Also, this approach should save us some more space since all icons will be densely packed.
Comment 1 by bugdroid1@chromium.org
, Feb 7 2017