Multi-layered icons in Breeze Icons?
David Hurka
david.hurka at mailbox.org
Tue Apr 14 20:59:43 BST 2020
Hi there,
I’m thinking about ways for some icons which can show different colors. Use
case is as follows: In Okular, Simone is working on icons for color chooser
buttons. There are three such buttons, so they need a) an icon to distinguish
them and b) a color to show the current color. In Okular, I am working on
icons for color mode selection. There are color modes of kind
“change color to ...”, so the color modes need a) icons to distinguish them
and b) a color to show which color will be used.
The current way is to fetch an icon with QIcon::fromTheme(), fetch one pixmap
from that icon, paint a colored rectangle on the pixmap, and create a QIcon
from that pixmap. The disadvantage is that the color rectangle has no nice
shape which follows the icon geometry.
My idea is to add multi-layered icons to the icon theme, which consist of
multiple SVG files. E. g.:
change-paper-color.svg
change-paper-color_overlay.svg
The overlay would be pure black as a fixed color.
Then we can make a QIconEngine which fetches the icon base from
change-paper-color.svg trough QIcon::fromTheme(), so the icon is recolored
though the Breeze style. Then it draws an overlay, which it gets from
change-paper-color_overlay.svg trough QIcon::fromTheme(), so the color shape
fits nicely to the icon base. If the overlay icon is not available, the
QIconEngine would fall back to boring rectangles.
Would it be possible (allowed) to add such multi-layer icons to the Breeze
icon set? Currently we need max two overlays per icon. Other applications,
which don’t implement such a QIconEngine, could still use the base icon.
And I will have to check whether it is possible at all to implement such a
QIconEngine.
Cheers, David
More information about the Visual-design
mailing list