Hello!
I’ve been spending a bit of time improving and cleaning up our documentation for icons. You can see the current version of this document in the front end developer resources: https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/Icons/ . Feel free to update and/or fix it with info I might have missed so far.
In this context, I realized that we never chose a name convention for icons. At the moment, there are a few disparities in icon names, and I’d like to avoid those in the future. It will make it easier to maintain, but also easier to use. Hereafter is my proposal for an icon name convention:
Icon name convention :
- Use kebab-case.
- For composite names, the main noun is the first in the name. Examples:
- ‘file-add’ and not ‘add-file’ because the main noun is ‘file’ here ‘add’ is the action
- ‘pdf-export’ and not ‘export-pdf’ because the main noun is ‘pdf’ and ‘export’ is the action.
- ‘bullet-black’ and not ‘black-bullet’ because the main noun is ‘bullet’ and ‘black’ is an adjective
- ‘emoticon-smile’ and not ‘smile-emoticon’ because the main noun is ‘emoticon’ and ‘smile’ is a complementary noun.
- ‘fast-forward’ is one noun with an hyphen.
- ‘file-pdf’ and not ‘pdf-file’ because in the meaning of this icon, the main meaning is ‘file’, while ‘pdf’ only helps to refine the meaning. On the contrary, ‘pdf-file’ would mean that we want a ‘file’ variation on the main concept of ‘pdf’.
Justifications:
- “Use kebab-case” → We already use kebab-case for HTML classes and ids in the XWiki UI
- “For composite names, the main noun is the first in the name.” → It allows the icons that are semantically close to be close in an alphabetically sorted list (see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/Icons/).
What do you think of this name convention for the icons in the XWiki Icon Set? Is there an additional rule that would make sense to define? Is there some additional examples we should include to make this convention as simple to understand as possible?
Thank you for your interest!
Lucas C.