Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to load "symbolic" icons respecting the dark/light mode?
Forum Updated to NodeBB v4.3 + New Features

How to load "symbolic" icons respecting the dark/light mode?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    buhtz
    wrote last edited by buhtz
    #1

    systray.png

    Hello,
    based on Free Desktop specifications an application should also provide a "symbolic" version of its logo. This is just a 22x22 pixel one color logo. It is intended to be used in the systray and it adapts to the dark or light mode currently used.

    This question is not about how to have two icons or an adaptive SVG file. The adaption to dark/light is made by the desktop environment (e.g. gnome). This is my understanding.

    So how do I load such an icon in Qt, that it gets adapted? Regarding this screenshot. That symbol (looking like a monochrome radioactive warning sign) should be white when the desktop theme is dark. But it is not.

    EDIT: I mean I don't want to make workarounds like this:

    # ...
    painter = QPainter(pixmap)
    painter.setRenderHint(QPainter.RenderHint.Antialiasing)
    painter.setPen(Qt.PenStyle.NoPen)
    painter.setBrush(QColor("white") if is_dark else QColor("black"))
    # ...
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved