[Python] Pyside6 - Change svg icon color dynamically

Discussão em 'Python' iniciado por Stack, Maio 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to build a pyside6 application with a light mode and a dark mode. That means that my icons also need to be light and dark mode.

    Now I was hoping to set the color of the QIcon SVGs inside my qss stylesheet with e.g.

    #menu_button {
    color: white;
    }


    I had the hope that fill="currentColor" inside the svg would make it possible for the icon to inherit the color property from the QSS, but it seems that this is not the case.

    Is there a good way to dynamically switch the color of svg icons? I would like to have a setting with "Light Mode" and "Dark Mode" or something like this that each loads a custom color set from their stylesheets.

    Continue reading...

Compartilhe esta Página