-3

There is 'old' way of setting dark mode in PyQt6/Pyside6 answered here: How do I use QT6 Dark Theme with PySide6?

But I found official Qt blog post https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5 and I not sure how to applied 'new' way for PySide6.

emcek
  • 459
  • 1
  • 6
  • 17

1 Answers1

1

With Qt 6.5, the GUI will follow the system style. If the OS is in dark mode, the PySide GUI will be too.

But, on Windows the default style is windowsvista and it doesn't have a dark mode. You have to use fusion style to get dark mode. (windows style also has a dark mode, but it's ugly as hell imo)

app = QApplication(sys.argv)
app.setStyle('fusion')
mahkitah
  • 562
  • 1
  • 6
  • 19
  • Ok, got it, but how can I force PySide6 to use dark regardless OS settings. – emcek Aug 31 '23 at 15:24
  • With the 'new way' you can't. Maybe future Qt versions will make `QStyleHints.colorScheme` writable. See the 'Beyond Qt 6.5' paragraph of the article you linked. – mahkitah Aug 31 '23 at 15:30