Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to detect and enable dark mode?



  • Does Qt automatically follow whatever color scheme is in use by GTK2?
    If so, does it only know about the current set of specified colors, or does it also know what the name of the GTK2 theme is e.g. AdwaitaDark?
    If it knows the name, how can obtain it programmatically?



  • @Publicnamer
    To answer my own question, look at:

    QColor color = QPalette().color(QPalette::Window);



  • Qt itself does not contain a portal to the existing GTK themes. There are lookalikes like AdwaitaQt, Breeze, and many of Kvantum's themes, but none of them actually get their data from the current GTK theme. This is the closest you will get without doing any work yourself. And it sucks.


Log in to reply