summarylogtreecommitdiffstats
path: root/gui.diff
blob: b1134fd6da352f5ecd1c3d6101cda77ca5a40089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- a/src/gui/input/panels/InputPanel.cpp
+++ b/src/gui/input/panels/InputPanel.cpp
@@ -9,6 +9,20 @@ InputPanel::InputPanel(wxWindow* parent)
 	: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER | wxWANTS_CHARS)
 {
 	Bind(wxEVT_LEFT_UP, &InputPanel::on_left_click, this);
+
+    // get the background color so we can determine the theme in use
+    wxColour bgColour = GetBackgroundColour();
+    uint32 bgLightness = (bgColour.GetRed() + bgColour.GetGreen() + bgColour.GetBlue()) / 3;
+    bool isDarkTheme = bgLightness < 128;
+    wxColour bgColourPrimary = bgColour; // color for odd rows
+    wxColour bgColourSecondary = bgColour.ChangeLightness(isDarkTheme ? 110 : 90); // color for even rows
+
+    // for very light themes we'll use a blue tint to match the older Windows Cemu look
+    if (bgLightness > 250)
+        bgColourSecondary = wxColour(bgColour.Red() - 13, bgColour.Green() - 6, bgColour.Blue() - 2);
+
+    kKeyColourNormalMode = bgColourPrimary;
+    kKeyColourActiveMode = bgColourSecondary;
 }
 
 void InputPanel::on_timer(const EmulatedControllerPtr& emulated_controller, const ControllerPtr& controller)
--- a/src/gui/input/panels/InputPanel.h
+++ b/src/gui/input/panels/InputPanel.h
@@ -12,9 +12,9 @@ class wxComboBox;
 class InputPanel : public wxPanel
 {
 public:
-	const wxColour kKeyColourNormalMode = 0xfafafa;
-	const wxColour kKeyColourEditMode = 0x99ccff;
-	const wxColour kKeyColourActiveMode = 0xE0E0E0;
+	wxColour kKeyColourNormalMode = 0xfafafa;
+	wxColour kKeyColourEditMode = 0x99ccff;
+	wxColour kKeyColourActiveMode = 0xE0E0E0;
 
 	InputPanel(wxWindow* parent);