Loading client/main.cpp +7 −0 Changes for client/main.cpp: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <QApplication> #include <QCommandLineParser> #include <QPalette> #include <QQmlApplicationEngine> #include <QQmlContext> #include <QtWebEngineQuick> Loading Loading @@ -64,6 +65,12 @@ int main(int argc, char *argv[]) { QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("localApi", &localApi); /* Detect system dark mode via actual palette window color brightness */ QColor winColor = app.palette().color(QPalette::Window); bool isDark = winColor.lightnessF() < 0.5; engine.rootContext()->setContextProperty("systemDarkMode", isDark); engine.loadFromModule("BlogiEditor", "Main"); if (engine.rootObjects().isEmpty()) Loading client/qml/Theme.qml +3 −5 Changes for client/qml/Theme.qml: 3 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3,12 +3,10 @@ import QtQuick QtObject { /* * Detect system dark/light theme by checking the actual system * window color brightness. This works reliably on Linux/KDE/GNOME * where Qt.styleHints.colorScheme often returns Unknown. * Dark mode is detected in C++ from QPalette and passed as * the context property "systemDarkMode". */ property SystemPalette _sys: SystemPalette {} readonly property bool dark: _sys.window.hslLightness < 0.5 readonly property bool dark: typeof systemDarkMode !== "undefined" ? systemDarkMode : true readonly property color bgPrimary: dark ? "#1e1e2e" : "#f5f5f7" readonly property color bgSecondary: dark ? "#2b2b3d" : "#e8e8ec" Loading Loading
client/main.cpp +7 −0 Changes for client/main.cpp: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <QApplication> #include <QCommandLineParser> #include <QPalette> #include <QQmlApplicationEngine> #include <QQmlContext> #include <QtWebEngineQuick> Loading Loading @@ -64,6 +65,12 @@ int main(int argc, char *argv[]) { QQmlApplicationEngine engine; engine.rootContext()->setContextProperty("localApi", &localApi); /* Detect system dark mode via actual palette window color brightness */ QColor winColor = app.palette().color(QPalette::Window); bool isDark = winColor.lightnessF() < 0.5; engine.rootContext()->setContextProperty("systemDarkMode", isDark); engine.loadFromModule("BlogiEditor", "Main"); if (engine.rootObjects().isEmpty()) Loading
client/qml/Theme.qml +3 −5 Changes for client/qml/Theme.qml: 3 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3,12 +3,10 @@ import QtQuick QtObject { /* * Detect system dark/light theme by checking the actual system * window color brightness. This works reliably on Linux/KDE/GNOME * where Qt.styleHints.colorScheme often returns Unknown. * Dark mode is detected in C++ from QPalette and passed as * the context property "systemDarkMode". */ property SystemPalette _sys: SystemPalette {} readonly property bool dark: _sys.window.hslLightness < 0.5 readonly property bool dark: typeof systemDarkMode !== "undefined" ? systemDarkMode : true readonly property color bgPrimary: dark ? "#1e1e2e" : "#f5f5f7" readonly property color bgSecondary: dark ? "#2b2b3d" : "#e8e8ec" Loading