diff --git a/main.cpp b/main.cpp index 0bdb23966..c644fbcac 100755 --- a/main.cpp +++ b/main.cpp @@ -171,16 +171,29 @@ int main(int argc, char *argv[]) QSettings set; bool isDark = set.value("darkMode", true).toBool(); Utility::setDarkMode(isDark); + bool pureBlack = set.value("pureBlackDarkMode", false).toBool(); + Utility::setPureBlack(pureBlack); QPixmapCache::setCacheLimit(256000); if (isDark) { qputenv("QT_QUICK_CONTROLS_CONF", ":/qtquickcontrols2_dark.conf"); - Utility::setAppQColor("lightestBackground", QColor(80,80,80)); - Utility::setAppQColor("lightBackground", QColor(72,72,72)); - Utility::setAppQColor("normalBackground", QColor(48,48,48)); - Utility::setAppQColor("darkBackground", QColor(39,39,39)); - Utility::setAppQColor("plotBackground", QColor(39,39,39)); + if (pureBlack) { + qputenv("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", "#000000"); + qputenv("QT_QUICK_CONTROLS_MATERIAL_DIALOG_COLOR", "#000000"); + + Utility::setAppQColor("lightestBackground", QColor(0,0,0)); + Utility::setAppQColor("lightBackground", QColor(0,0,0)); + Utility::setAppQColor("normalBackground", QColor(0,0,0)); + Utility::setAppQColor("darkBackground", QColor(0,0,0)); + Utility::setAppQColor("plotBackground", QColor(0,0,0)); + } else { + Utility::setAppQColor("lightestBackground", QColor(80,80,80)); + Utility::setAppQColor("lightBackground", QColor(72,72,72)); + Utility::setAppQColor("normalBackground", QColor(48,48,48)); + Utility::setAppQColor("darkBackground", QColor(39,39,39)); + Utility::setAppQColor("plotBackground", QColor(39,39,39)); + } Utility::setAppQColor("normalText", QColor(180,180,180)); Utility::setAppQColor("lightText", QColor(215,215,215)); Utility::setAppQColor("disabledText", QColor(127,127,127)); diff --git a/mobile/Settings.qml b/mobile/Settings.qml index a575f5b78..08e16f3ae 100644 --- a/mobile/Settings.qml +++ b/mobile/Settings.qml @@ -26,10 +26,12 @@ import Vedder.vesc.utility 1.0 Item { property bool mLastDarkMode: false + property bool mLastPureBlack: false property var dialogParent: ApplicationWindow.overlay function openDialog() { mLastDarkMode = Utility.isDarkMode() + mLastPureBlack = Utility.isPureBlack() dialog.open() } @@ -133,6 +135,16 @@ Item { Utility.setDarkMode(checked) } } + + CheckBox { + id: pureBlackBox + Layout.fillWidth: true + text: "Use Pure Black for Dark Mode" + checked: Utility.isPureBlack() + onCheckedChanged: { + Utility.setPureBlack(checked) + } + } } } @@ -166,7 +178,7 @@ Item { VescIf.setWakeLock(VescIf.isPortConnected()) } - if (Utility.isDarkMode() !== mLastDarkMode) { + if (Utility.isDarkMode() !== mLastDarkMode || Utility.isPureBlack() !== mLastPureBlack) { darkChangedDialog.open() } diff --git a/utility.cpp b/utility.cpp index cf175395b..da0e9fe0e 100755 --- a/utility.cpp +++ b/utility.cpp @@ -81,6 +81,7 @@ QMap Utility::mAppColors = { }; bool Utility::isDark = false; +bool Utility::mIsPureBlack = false; Utility::Utility(QObject *parent) : QObject(parent) { @@ -2548,6 +2549,18 @@ bool Utility::isDarkMode() return isDark; } +void Utility::setPureBlack(bool pureBlackSetting) +{ + mIsPureBlack = pureBlackSetting; + QSettings set; + set.setValue("pureBlackDarkMode", pureBlackSetting); +} + +bool Utility::isPureBlack() +{ + return mIsPureBlack; +} + QString Utility::getThemePath() { if (isDark) { diff --git a/utility.h b/utility.h index 10b012a04..cbc080fb4 100644 --- a/utility.h +++ b/utility.h @@ -121,6 +121,8 @@ class Utility : public QObject Q_INVOKABLE static QString getAppHexColor(QString colorName); Q_INVOKABLE static void setDarkMode(bool isDark); Q_INVOKABLE static bool isDarkMode(); + Q_INVOKABLE static void setPureBlack(bool pureBlack); + Q_INVOKABLE static bool isPureBlack(); Q_INVOKABLE static QString getThemePath(); Q_INVOKABLE static QVariantMap getSafeAreaMargins(QQuickWindow *window); @@ -169,6 +171,7 @@ public slots: static QMap mAppColors; static bool isDark; + static bool mIsPureBlack; }; #endif // UTILITY_H