Loading client/CMakeLists.txt +1 −3 Changes for client/CMakeLists.txt: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -15,16 +15,14 @@ qt_add_executable(blogi-editor publishclient.h localapi.cpp localapi.h themeprovider.h ) set_source_files_properties(qml/Theme.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) qt_add_qml_module(blogi-editor URI BlogiEditor VERSION 1.0 QML_FILES qml/Main.qml qml/Theme.qml qml/SidebarSection.qml qml/WidgetToolbar.qml qml/DocumentTree.qml Loading client/main.cpp +3 −1 Changes for client/main.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "documentmanager.h" #include "localapi.h" #include "publishclient.h" #include "themeprovider.h" #include <QApplication> #include <QCommandLineParser> Loading Loading @@ -69,7 +70,8 @@ int main(int argc, char *argv[]) { /* 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); ThemeProvider theme(isDark); engine.rootContext()->setContextProperty("Theme", &theme); engine.loadFromModule("BlogiEditor", "Main"); Loading client/themeprovider.h 0 → 100644 +82 −0 Changes for client/themeprovider.h: 82 added lines, 0 removed lines. Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2026, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #pragma once #include <QObject> #include <QColor> class ThemeProvider : public QObject { Q_OBJECT Q_PROPERTY(bool dark READ dark CONSTANT) Q_PROPERTY(QColor bgPrimary READ bgPrimary CONSTANT) Q_PROPERTY(QColor bgSecondary READ bgSecondary CONSTANT) Q_PROPERTY(QColor bgTertiary READ bgTertiary CONSTANT) Q_PROPERTY(QColor bgHover READ bgHover CONSTANT) Q_PROPERTY(QColor textPrimary READ textPrimary CONSTANT) Q_PROPERTY(QColor textSecondary READ textSecondary CONSTANT) Q_PROPERTY(QColor textMuted READ textMuted CONSTANT) Q_PROPERTY(QColor accent READ accent CONSTANT) Q_PROPERTY(QColor accentHover READ accentHover CONSTANT) Q_PROPERTY(QColor border READ border CONSTANT) Q_PROPERTY(QColor success READ success CONSTANT) Q_PROPERTY(QColor warning READ warning CONSTANT) Q_PROPERTY(QColor danger READ danger CONSTANT) Q_PROPERTY(int radius READ radius CONSTANT) public: explicit ThemeProvider(bool isDark, QObject *parent = nullptr) : QObject(parent), _dark(isDark) {} bool dark() const { return _dark; } QColor bgPrimary() const { return _dark ? QColor("#1e1e2e") : QColor("#f5f5f7"); } QColor bgSecondary() const { return _dark ? QColor("#2b2b3d") : QColor("#e8e8ec"); } QColor bgTertiary() const { return _dark ? QColor("#363650") : QColor("#dcdce2"); } QColor bgHover() const { return _dark ? QColor("#3f3f5c") : QColor("#d0d0d8"); } QColor textPrimary() const { return _dark ? QColor("#cdd6f4") : QColor("#1c1c1e"); } QColor textSecondary() const { return _dark ? QColor("#9399b2") : QColor("#48484a"); } QColor textMuted() const { return _dark ? QColor("#6c7086") : QColor("#8e8e93"); } QColor accent() const { return _dark ? QColor("#89b4fa") : QColor("#0071e3"); } QColor accentHover() const { return _dark ? QColor("#74c7ec") : QColor("#0077ed"); } QColor border() const { return _dark ? QColor("#45475a") : QColor("#c6c6c8"); } QColor success() const { return _dark ? QColor("#a6e3a1") : QColor("#34c759"); } QColor warning() const { return _dark ? QColor("#f9e2af") : QColor("#ff9f0a"); } QColor danger() const { return _dark ? QColor("#f38ba8") : QColor("#ff3b30"); } int radius() const { return 6; } private: bool _dark; }; Loading
client/CMakeLists.txt +1 −3 Changes for client/CMakeLists.txt: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -15,16 +15,14 @@ qt_add_executable(blogi-editor publishclient.h localapi.cpp localapi.h themeprovider.h ) set_source_files_properties(qml/Theme.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE) qt_add_qml_module(blogi-editor URI BlogiEditor VERSION 1.0 QML_FILES qml/Main.qml qml/Theme.qml qml/SidebarSection.qml qml/WidgetToolbar.qml qml/DocumentTree.qml Loading
client/main.cpp +3 −1 Changes for client/main.cpp: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "documentmanager.h" #include "localapi.h" #include "publishclient.h" #include "themeprovider.h" #include <QApplication> #include <QCommandLineParser> Loading Loading @@ -69,7 +70,8 @@ int main(int argc, char *argv[]) { /* 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); ThemeProvider theme(isDark); engine.rootContext()->setContextProperty("Theme", &theme); engine.loadFromModule("BlogiEditor", "Main"); Loading
client/themeprovider.h 0 → 100644 +82 −0 Changes for client/themeprovider.h: 82 added lines, 0 removed lines. Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2026, Jan Koester jan.koester@gmx.net * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #pragma once #include <QObject> #include <QColor> class ThemeProvider : public QObject { Q_OBJECT Q_PROPERTY(bool dark READ dark CONSTANT) Q_PROPERTY(QColor bgPrimary READ bgPrimary CONSTANT) Q_PROPERTY(QColor bgSecondary READ bgSecondary CONSTANT) Q_PROPERTY(QColor bgTertiary READ bgTertiary CONSTANT) Q_PROPERTY(QColor bgHover READ bgHover CONSTANT) Q_PROPERTY(QColor textPrimary READ textPrimary CONSTANT) Q_PROPERTY(QColor textSecondary READ textSecondary CONSTANT) Q_PROPERTY(QColor textMuted READ textMuted CONSTANT) Q_PROPERTY(QColor accent READ accent CONSTANT) Q_PROPERTY(QColor accentHover READ accentHover CONSTANT) Q_PROPERTY(QColor border READ border CONSTANT) Q_PROPERTY(QColor success READ success CONSTANT) Q_PROPERTY(QColor warning READ warning CONSTANT) Q_PROPERTY(QColor danger READ danger CONSTANT) Q_PROPERTY(int radius READ radius CONSTANT) public: explicit ThemeProvider(bool isDark, QObject *parent = nullptr) : QObject(parent), _dark(isDark) {} bool dark() const { return _dark; } QColor bgPrimary() const { return _dark ? QColor("#1e1e2e") : QColor("#f5f5f7"); } QColor bgSecondary() const { return _dark ? QColor("#2b2b3d") : QColor("#e8e8ec"); } QColor bgTertiary() const { return _dark ? QColor("#363650") : QColor("#dcdce2"); } QColor bgHover() const { return _dark ? QColor("#3f3f5c") : QColor("#d0d0d8"); } QColor textPrimary() const { return _dark ? QColor("#cdd6f4") : QColor("#1c1c1e"); } QColor textSecondary() const { return _dark ? QColor("#9399b2") : QColor("#48484a"); } QColor textMuted() const { return _dark ? QColor("#6c7086") : QColor("#8e8e93"); } QColor accent() const { return _dark ? QColor("#89b4fa") : QColor("#0071e3"); } QColor accentHover() const { return _dark ? QColor("#74c7ec") : QColor("#0077ed"); } QColor border() const { return _dark ? QColor("#45475a") : QColor("#c6c6c8"); } QColor success() const { return _dark ? QColor("#a6e3a1") : QColor("#34c759"); } QColor warning() const { return _dark ? QColor("#f9e2af") : QColor("#ff9f0a"); } QColor danger() const { return _dark ? QColor("#f38ba8") : QColor("#ff3b30"); } int radius() const { return 6; } private: bool _dark; };