diff --git a/src/gui/main.cpp b/src/gui/main.cpp index f9a92fda2d1b..c77202e37b9a 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -92,6 +92,33 @@ int main(int argc, char **argv) OCC::Application app(argc, argv); + //NMC customization: enforce our palette to avoid dark mode colors + QPalette palette = app.palette(); + + palette.setColor(QPalette::WindowText, QColor(0, 0, 0)); + palette.setColor(QPalette::Button, QColor(236, 236, 236)); + palette.setColor(QPalette::Light, QColor(255, 255, 255)); + palette.setColor(QPalette::Midlight, QColor(245, 245, 245)); + palette.setColor(QPalette::Dark, QColor(191, 191, 191)); + palette.setColor(QPalette::Mid, QColor(168, 168, 168)); + palette.setColor(QPalette::Text, QColor(0, 0, 0)); + palette.setColor(QPalette::BrightText, QColor(255, 255, 255)); + palette.setColor(QPalette::ButtonText, QColor(0, 0, 0)); + palette.setColor(QPalette::Base, QColor(255, 255, 255)); + palette.setColor(QPalette::Window, QColor(236, 236, 236)); + palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); + palette.setColor(QPalette::Highlight, QColor(179, 215, 255)); + palette.setColor(QPalette::HighlightedText, QColor(0, 0, 0)); + palette.setColor(QPalette::Link, QColor(0, 104, 218)); + palette.setColor(QPalette::LinkVisited, QColor(255, 0, 255)); + palette.setColor(QPalette::AlternateBase, QColor(245, 245, 245)); + palette.setColor(QPalette::NoRole, QColor(0, 0, 0)); + palette.setColor(QPalette::ToolTipBase, QColor(255, 255, 255)); + palette.setColor(QPalette::ToolTipText, QColor(0, 0, 0)); + palette.setColor(QPalette::PlaceholderText, QColor(0, 0, 0)); + + app.setPalette(palette); + #ifndef Q_OS_WIN signal(SIGPIPE, SIG_IGN); #endif diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 407db59bab67..100df5d64d89 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -839,7 +839,9 @@ double Theme::getColorDarkness(const QColor &color) bool Theme::isDarkColor(const QColor &color) { - return getColorDarkness(color) > 0.5; + //return getColorDarkness(color) > 0.5; + Q_UNUSED(color) + return false; } QColor Theme::getBackgroundAwareLinkColor(const QColor &backgroundColor) @@ -951,16 +953,16 @@ void Theme::connectToPaletteSignal() bool Theme::darkMode() { - connectToPaletteSignal(); - switch (qGuiApp->styleHints()->colorScheme()) - { - case Qt::ColorScheme::Dark: - return true; - case Qt::ColorScheme::Light: - return false; - case Qt::ColorScheme::Unknown: - return Theme::isDarkColor(QGuiApplication::palette().window().color()); - } + // connectToPaletteSignal(); + // switch (qGuiApp->styleHints()->colorScheme()) + // { + // case Qt::ColorScheme::Dark: + // return true; + // case Qt::ColorScheme::Light: + // return false; + // case Qt::ColorScheme::Unknown: + // return Theme::isDarkColor(QGuiApplication::palette().window().color()); + // } return false; } diff --git a/test/testtheme.cpp b/test/testtheme.cpp index 542c3a9b4b2b..8b66ad646a6a 100644 --- a/test/testtheme.cpp +++ b/test/testtheme.cpp @@ -49,7 +49,8 @@ private slots: const auto iconPath = OCC::Theme::hidpiFileName(iconName + ".png", backgroundColor, &paintDevice); - QCOMPARE(iconPath, ":/client/theme/white/" + iconName + ".png"); + // QCOMPARE(iconPath, ":/client/theme/white/" + iconName + ".png"); + Q_UNUSED(iconPath) } void testHidpiFileName_lightBackground_returnPathToBlackIcon() @@ -72,7 +73,8 @@ private slots: const auto iconPath = OCC::Theme::hidpiFileName(iconName + ".png", backgroundColor, &paintDevice); - QCOMPARE(iconPath, ":/client/theme/white/" + iconName + "@2x.png"); + // QCOMPARE(iconPath, ":/client/theme/white/" + iconName + "@2x.png"); + Q_UNUSED(iconPath) } void testIsDarkColor_nextcloudBlue_returnTrue() @@ -81,7 +83,8 @@ private slots: const auto result = OCC::Theme::isDarkColor(color); - QCOMPARE(result, true); + // QCOMPARE(result, true); + Q_UNUSED(result) } void testIsDarkColor_lightColor_returnFalse() @@ -99,7 +102,8 @@ private slots: const auto result = OCC::Theme::isDarkColor(color); - QCOMPARE(result, true); + // QCOMPARE(result, true); + Q_UNUSED(result) } void testIsHidpi_hidpi_returnTrue()