Color Theme-Adaptive Icons
Kdenlive now supports icons that automatically adapt to the specific color theme your desktop uses. This especially allows the Breeze icons to blend into the overall color scheme that you’ve set. Whenever you use a color theme with bright background and dark foreground (for good contrast), Kdenlive shows its icons using your dark foreground color. If you prefer a dark color theme with dark background and lighter foreground, then Kdenlive icons adapt to this too. No need to switch icon themes anymore when switching desktop color themes. One icon set for all your desktop color themes. Sweet, isn’t it?
KDE Frameworks 5 define a set of six «logical» colors that when used, automatically adapt to the currently set color theme. The advantage of this is that you only need to maintain a single icon set, instead of potentially multiple icon sets. Such as a one icon set designed to work well with bright background colors, and another icon set to work well with dark background colors. Now, you only need to design your icons once, using the logical colors instead of hardcoded, fixed colors.
The Adaptive Colors
ColorScheme-Text
(#4d4d4d
) is probably the class most used of all color-theming CSS classes. Use it for painting all the ordinary icon parts that should adapt to the current color theme, but still giving the typical Breeze monochrome appearance.ColorScheme-Highlight
(#3daee9
) should be used for highlighting only, and then only sparsely. It is a contrast color. Some Kdenlive icons related to the timeline selection region also use this themed color to depict the region.ColorScheme-Background
(#eff0f1
). Instead of painting over other icon elements using the background color, cut out such parts. Any decent SVG editor, such as Inkscape is able to cut out regions, so the original background or any underlying elements become visible.ColorScheme-PositiveText
(#2ecc71
) can be used to indicate states, such as synchronized, connected, et cetera. It can also be used, but to a lesser extent, to emphasize operations, such as new and add. However, at the time of this writing, most Breeze icons now use this adaptive color only for showing states, but not any more for operations.ColorScheme-NegativeText
(#da4453
) can be used to emphasize operations, such as delete and remove.ColorScheme-NeutralText
(#f67400
) can be used as an accentuation color, more so, when ColorScheme-Highlight
isn’t appropriate or desired. Use with care, though.Icon Sizes
Please note that the grid is purely for design, to help you with getting your element sizes correct, such as line widths, and so on.
22×22 design grid
16×16 design grid
- 16×16 design grid for menu items and some timeline icons, but not for track header icons. If an icon is never used in these contexts, you can skip this design size.
- 22×22 design grid for toolbar buttons.
CSS Style Code
defs
and style
, with their attributes and content. See also the following code snippet with all CSS class declarations:<defs id="defs3051"> <style type="text/css" id="current-color-scheme"> .ColorScheme-Text {color:#4d4d4d;} .ColorScheme-Highlight {color:#3daee9;} .ColorScheme-Background {color:#eff0f1
;} .ColorScheme-PositiveText {color:#2ecc71
;} .ColorScheme-NegativeText {color:#da4453
;} .ColorScheme-NeutralText {color:#f67400
;} </style> </defs>
class=
attributes to each element, with one of the CSS class names listed above; for instance, ColorScheme-Text
, et cetera. Finally, set all colors for filling and strokes of all graphical elements to the special color currentColor
instead of their specific color values.
If you did everything correctly, then the filemanager preview should show your icon using the correct colors, instead of black.
- type=”text/css” – without the type attribute your icon will be rendered black instead of the correct and adaptive colors.
- id=”current-color-scheme” – without the proper id attribute, you icon won’t adapt the current desktop color scheme.
Useful References
As it is often the case, the source code kiconloader.cpp
(KF5 git repository clone on GitHub) of comes to our rescue. Look out for the definition of STYLESHEET_TEMPLATE: it contains all supported CSS classes for theming. See above for the definitive list of them.
The KDE Visual Design Group Human Interaction Guide (HIG) is also worth a good read:
- HIG section Color talks about the Breeze color theme and the color roles.
- HIG section Icon Design illustrates rules and designs in more depth.
And finally, some overall info about color theme-adaptive Breeze icons: performance updates for breeze icons (blog KDE and Linux).