Report color scheme (light/dark)
Implement QPlatformTheme::colorScheme
to report
whether a light or dark color scheme is used.
This gets used by QApplication::styleHints()->colorScheme()
[1]
(introduced in Qt 5.6) to retrieve the current color scheme and is
used e.g. by the Qt 6 variant of LibreOffice to select corresponding
app colors (see LibreOffice bug report [2] that also has a minimum
sample program to reproduce).
The logic is based on the one that xdg-desktop-portal-kde uses. [3]
[1] https://doc.qt.io/qt-6/qstylehints.html#colorScheme-prop [2] https://bugs.documentfoundation.org/show_bug.cgi?id=162003 [3] https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/d9e37b2cfce426a8dfe761bb821b9ae9d6e0c50a/src/settings.cpp#L252-266