summarylogtreecommitdiffstats
path: root/gui.diff
blob: 4e7d0de71c6510621975a36c5da6144c0ca71a3b (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -1692,8 +1692,6 @@ class CemuAboutDialog : public wxDialog
 	{
 		SetIcon(wxICON(M_WND_ICON128));
 
-		this->SetBackgroundColour(wxColour(0xFFFFFFFF));
-
 		wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this);
 
 		wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
--- a/src/gui/components/wxGameList.cpp
+++ b/src/gui/components/wxGameList.cpp
@@ -358,16 +358,9 @@ long wxGameList::GetStyleFlags(Style style) const
 void wxGameList::UpdateItemColors(sint32 startIndex)
 {
     wxWindowUpdateLocker lock(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);
+	wxColour bgColourPrimary = GetBackgroundColour();
+	wxColour bgColourSecondary = wxHelper::CalculateAccentColour(bgColourPrimary);
 
     for (int i = startIndex; i < GetItemCount(); ++i)
     {
@@ -1143,4 +1136,4 @@ bool wxGameList::QueryIconForTitle(TitleId titleId, int& icon, int& iconSmall)
 void wxGameList::DeleteCachedStrings() 
 {
 	m_name_cache.clear();
-}
\ No newline at end of file
+}
--- a/src/gui/components/wxTitleManagerList.cpp
+++ b/src/gui/components/wxTitleManagerList.cpp
@@ -172,10 +172,11 @@ wxString wxTitleManagerList::OnGetItemText(long item, long column) const
 
 wxItemAttr* wxTitleManagerList::OnGetItemAttr(long item) const
 {
-	const auto entry = GetTitleEntry(item);
-	const wxColour kSecondColor{ 0xFDF9F2 };
-	static wxListItemAttr s_coloured_attr(GetTextColour(), kSecondColor, GetFont());
-	return item % 2 == 0 ? nullptr : &s_coloured_attr;
+	static wxColour bgColourPrimary = GetBackgroundColour();
+	static wxColour bgColourSecondary = wxHelper::CalculateAccentColour(bgColourPrimary);
+	static wxListItemAttr s_primary_attr(GetTextColour(), bgColourPrimary, GetFont());
+	static wxListItemAttr s_secondary_attr(GetTextColour(), bgColourSecondary, GetFont());
+	return item % 2 == 0 ? &s_primary_attr : &s_secondary_attr;
 }
 
 boost::optional<wxTitleManagerList::TitleEntry&> wxTitleManagerList::GetTitleEntry(long item)
@@ -1274,4 +1275,4 @@ void wxTitleManagerList::ClearItems()
 void wxTitleManagerList::AutosizeColumns()
 {
 	wxAutosizeColumns(this, ColumnTitleId, ColumnMAX - 1);
-}
\ No newline at end of file
+}
--- a/src/gui/input/panels/InputPanel.h
+++ b/src/gui/input/panels/InputPanel.h
@@ -12,7 +12,7 @@ class wxComboBox;
 class InputPanel : public wxPanel
 {
 public:
-	const wxColour kKeyColourNormalMode = 0xfafafa;
+	const wxColour kKeyColourNormalMode = GetBackgroundColour();
 	const wxColour kKeyColourEditMode = 0x99ccff;
 	const wxColour kKeyColourActiveMode = 0xE0E0E0;
 
--- a/src/gui/wxHelper.h
+++ b/src/gui/wxHelper.h
@@ -22,5 +22,16 @@ namespace wxHelper
         return wxString::FromUTF8(str.data(), str.size());
     }
 
+	inline wxColour CalculateAccentColour(const wxColour& bgColour)
+	{
+		wxColour bgColourSecondary;
+		const uint32 bgLightness = (bgColour.GetRed() + bgColour.GetGreen() + bgColour.GetBlue()) / 3;
+		const bool isDarkTheme = bgLightness < 128;
+		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);
+		return bgColourSecondary;
+	}
 
 };