From c7d7972213f8bbae63417d84ce321650c5589f20 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 8 Dec 2021 14:22:26 +0000 Subject: [PATCH] Stealth themes .. more monotone and subtler coloring which is also used to change the chart bar hover and tab decorations. --- src/Charts/ChartBar.cpp | 11 ++++++++- src/Gui/Colors.cpp | 53 ++++++++++++++++++++++++++++++++++++++++- src/Gui/Colors.h | 1 + src/Gui/Pages.cpp | 2 +- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/Charts/ChartBar.cpp b/src/Charts/ChartBar.cpp index aae91e55b3..e14bc2bbc2 100644 --- a/src/Charts/ChartBar.cpp +++ b/src/Charts/ChartBar.cpp @@ -471,7 +471,16 @@ ChartBarItem::paintEvent(QPaintEvent *) painter.drawText(body, text, Qt::AlignHCenter | Qt::AlignVCenter); // draw the bar - if (checked) painter.fillRect(QRect(0,0,geometry().width(), 3*dpiXFactor), QBrush(GColor(CPLOTMARKER))); + if (checked) { + // at the top if the chartbar background is different to the plot background + if (GColor(CCHARTBAR) != color) painter.fillRect(QRect(0,0,geometry().width(), 3*dpiXFactor), QBrush(GColor(CPLOTMARKER))); + else { + // only underline the text with a little extra (why adding "XXX" below) + QFontMetrics fm(font()); + double width = fm.boundingRect(text+"XXX").width(); + painter.fillRect(QRect((geometry().width()-width)/2.0,geometry().height()-(3*dpiXFactor),width, 3*dpiXFactor), QBrush(GColor(CPLOTMARKER))); + } + } // draw the menu indicator if (underMouse()) { diff --git a/src/Gui/Colors.cpp b/src/Gui/Colors.cpp index 4952c1b649..a700de1084 100644 --- a/src/Gui/Colors.cpp +++ b/src/Gui/Colors.cpp @@ -743,6 +743,7 @@ Themes::Themes() // MODERN DARK (Sublime Editor inspired) add.name = tr("Modern Dark"); add.dark = true; + add.stealth = false; colors << QColor(19,19,19) // Plot Background << QColor(32,32,32) // Toolbar and Sidebar Chrome << QColor(85,170,255) // Accent color (markers) @@ -763,6 +764,7 @@ Themes::Themes() // MODERN LIGHT (SAP Fiori Belize inspired) add.name = tr("Modern Light"); add.dark = false; + add.stealth = false; colors << QColor(Qt::white) // Plot Background << QColor(0xef,0xf4,0xf9) // Toolbar and Sidebar Chrome << QColor(0x26,0x84,0xf6) // Accent color (markers) @@ -779,8 +781,49 @@ Themes::Themes() themes << add; colors.clear(); + // STEALTH DARK (tab placement and mostly black) + add.name = tr("Modern Stealth Dark"); + add.dark = true; + add.stealth = true; + colors << QColor(19,19,19) // Plot Background + << QColor(19,19,19) // Toolbar and Sidebar Chrome + << QColor(85,170,255) // Accent color (markers) + << QColor(194,194,194) // Selection color + << QColor(Qt::yellow) // Critical Power and W'Bal + << QColor(Qt::red) // Heartrate + << QColor(Qt::green) // Speed + << QColor(255,170,0) // Power + << QColor(0,204,204) // Cadence + << QColor(Qt::magenta) // Torque + << QColor(19,19,19) // Overview Background + << QColor(30,30,30);// Overview Card Background + add.colors = colors; + themes << add; + colors.clear(); + + // STEALTH LIGHT (tab placement and mostly white) + add.name = tr("Modern Stealth Light"); + add.dark = false; + add.stealth = true; + colors << QColor(255,255,255) // Plot Background + << QColor(255,255,255) // Toolbar and Sidebar Chrome + << QColor(52,99,255) // Accent color (markers) + << QColor(Qt::blue) // Selection color + << QColor(Qt::darkMagenta) // Critical Power and W'Bal + << QColor(Qt::red) // Heartrate + << QColor(85,170,0) // Speed + << QColor(255,170,0) // Power + << QColor(0,204,204) // Cadence + << QColor(Qt::magenta) // Torque + << QColor(255,255,255) // Overview Background + << QColor(245,245,245);// Overview Card Background + add.colors = colors; + themes << add; + colors.clear(); + add.name = tr("Gnome Adwaita Dark"); add.dark = true; + add.stealth = false; colors << QColor(19,19,19) // Plot Background << QColor(44,49,51) // Toolbar and Sidebar Chrome << QColor(85,170,255) // Accent color (markers) @@ -799,6 +842,7 @@ Themes::Themes() add.name = tr("Team Colours (light)"); add.dark = false; + add.stealth = false; colors << QColor(Qt::white) // Plot Background << QColor(0x36,0x37,0x4b) // Toolbar and Sidebar Chrome << QColor(0x65,0x69,0xa5) // Accent color (markers) @@ -817,6 +861,7 @@ Themes::Themes() add.name = tr("Ollie's Oatmeal (light)"); add.dark = false; + add.stealth = false; colors << QColor(0xdd,0xef,0xe6) // Plot Background << QColor(0x31,0x25,0x0b) // Toolbar and Sidebar Chrome << QColor(0x8d,0x57,0x30) // Accent color (markers) @@ -835,6 +880,7 @@ Themes::Themes() add.name = tr("Mustang (dark)"); // ** DARK ** add.dark = true; + add.stealth = false; colors << QColor(0,0,0) // Plot Background << QColor(35,35,35) // Toolbar and Sidebar Chrome << QColor(255,152,0) // Accent color (markers) @@ -853,6 +899,7 @@ Themes::Themes() add.name = tr("Mono (dark)"); // New v3.1 default colors // ** DARK ** add.dark = true; + add.stealth = false; colors << QColor(Qt::black) // Plot Background << QColor(Qt::black) // Toolbar and Sidebar Chrome << QColor(Qt::white) // Accent color (markers) @@ -871,6 +918,7 @@ Themes::Themes() add.name = tr("Mono (light)"); // New v3.1 default colors // ** LIGHT ** add.dark = false; + add.stealth = false; colors << QColor(Qt::white) // Plot Background << QColor(Qt::white) // Toolbar and Sidebar Chrome << QColor(Qt::black) // Accent color (markers) @@ -890,6 +938,7 @@ Themes::Themes() // we can add more later .... add.name = tr("Schoberer (light)"); // Old GoldenCheetah colors // ** LIGHT ** add.dark = false; + add.stealth = false; colors << QColor(Qt::white) // Plot Background << QColor(0xec,0xec,0xec) // Toolbar and Sidebar Chrome << QColor(Qt::black) // Accent color (markers) @@ -952,7 +1001,9 @@ GCColor::applyTheme(int index) break; case CHOVER: - color = theme.dark ? QColor(50,50,50) : QColor(200,200,200); + // stealthy themes use overview card background for hover color since they are close + // all other themes get a boring default + color = theme.stealth ? ColorList[96].color : (theme.dark ? QColor(50,50,50) : QColor(200,200,200)); break; case CPLOTSYMBOL: diff --git a/src/Gui/Colors.h b/src/Gui/Colors.h index 1d72c6da92..0ce5883f4f 100644 --- a/src/Gui/Colors.h +++ b/src/Gui/Colors.h @@ -89,6 +89,7 @@ class ColorTheme // all public QString name; bool dark; + bool stealth; QList colors; }; diff --git a/src/Gui/Pages.cpp b/src/Gui/Pages.cpp index f39ba3aad5..bd6f67c1f8 100644 --- a/src/Gui/Pages.cpp +++ b/src/Gui/Pages.cpp @@ -1460,7 +1460,7 @@ ColorsPage::applyThemeClicked() break; case CHOVER: - color = theme.dark ? QColor(50,50,50) : QColor(200,200,200); + color = theme.stealth ? theme.colors[11] : (theme.dark ? QColor(50,50,50) : QColor(200,200,200)); break; case CPLOTSYMBOL: