D19392: shannon entropy to guess monochrome icon

Marco Martin noreply at phabricator.kde.org
Wed Feb 27 16:36:25 GMT 2019


mart added a comment.


  > Can you elaborate on the problem we're trying to fix.
  
  so, when we have KiconLoader (ie using the desktop style and we can rely on kf5 dependencies)  to colorize icons we use our stylesheet-based color replacement in svgs and everything is always awesome: monochrome icons colorized to the color palette and clolor icons stay as they are.
  
  where we can't use kiconloader due dependencies (kirigami is tier 1)  which is usually Android. Or technically one can do a kirigami app with zero dependencies and not have qqc2-desktop-style installed and run it on gnome.
  
  so, we colorize monochrome icons treating them as just masks, and that works ok, tough there isn't any spec to know with 100% certainty if an icon is monochrome or colored (all icon names that end up with -symbolys usually are monochrome, but in breeze and other themes monochrome icons are all over the place and often it depends from the icon size)
  
  in theory all i would need is the access to the svg file and look at the styling inside, but the public QIcon/QIconloader api doesn't let me access the final resolved name of the icon file, being it a png or an svg.
  
  so, the only resort that i have, is actually.. looking at the pixels in the rendering image :/
  so, very low entropy -> yay is monochrome, let's paint over it (the actual mask-ification shold be done by a shader ideally, but that's a completely different problem)
  high entropy and/or many saturated pixels -> leave it as it is and assume is a colored icon

REPOSITORY
  R169 Kirigami

REVISION DETAIL
  https://phabricator.kde.org/D19392

To: mart, #kirigami
Cc: davidedmundson, plasma-devel, domson, dkardarakos, apol, mart, hein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190227/df841df9/attachment.html>


More information about the Plasma-devel mailing list