Multi-layered icons in Breeze Icons?
David Hurka
david.hurka at mailbox.org
Sun Apr 19 21:02:17 BST 2020
Hi there,
I wrote a demo application with an OverlayIconEngine, which actually works.
https://invent.kde.org/davidhurka/overlay-icon-engine-demo
In the meantime I found KIconLoader. Possibly KIconLoader could be extended to
support additional classes to recolor icon elements. But OverlayIconEngine is
platform independent, and uses the existing icon engines to load the icons
from the icon theme.
So the remaining question is: Can we add multi-layered icons to Breeze Icons?
Since no one complained until now, I will submit a patch with such icons soon.
I need them for the color mode menu in Okular.
Cheers, David
On 4/14/20 9:59 PM David Hurka wrote:
> 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