mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 02:54:17 +01:00
Fix various colour values for dark themes (#439)
This commit is contained in:
parent
94b179ef5a
commit
2842615edb
@ -1696,8 +1696,6 @@ public:
|
|||||||
{
|
{
|
||||||
SetIcon(wxICON(M_WND_ICON128));
|
SetIcon(wxICON(M_WND_ICON128));
|
||||||
|
|
||||||
this->SetBackgroundColour(wxColour(0xFFFFFFFF));
|
|
||||||
|
|
||||||
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this);
|
wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this);
|
||||||
|
|
||||||
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -358,16 +358,9 @@ long wxGameList::GetStyleFlags(Style style) const
|
|||||||
void wxGameList::UpdateItemColors(sint32 startIndex)
|
void wxGameList::UpdateItemColors(sint32 startIndex)
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker lock(this);
|
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
|
wxColour bgColourPrimary = GetBackgroundColour();
|
||||||
if (bgLightness > 250)
|
wxColour bgColourSecondary = wxHelper::CalculateAccentColour(bgColourPrimary);
|
||||||
bgColourSecondary = wxColour(bgColour.Red() - 13, bgColour.Green() - 6, bgColour.Blue() - 2);
|
|
||||||
|
|
||||||
for (int i = startIndex; i < GetItemCount(); ++i)
|
for (int i = startIndex; i < GetItemCount(); ++i)
|
||||||
{
|
{
|
||||||
@ -1143,4 +1136,4 @@ bool wxGameList::QueryIconForTitle(TitleId titleId, int& icon, int& iconSmall)
|
|||||||
void wxGameList::DeleteCachedStrings()
|
void wxGameList::DeleteCachedStrings()
|
||||||
{
|
{
|
||||||
m_name_cache.clear();
|
m_name_cache.clear();
|
||||||
}
|
}
|
||||||
|
@ -172,10 +172,11 @@ wxString wxTitleManagerList::OnGetItemText(long item, long column) const
|
|||||||
|
|
||||||
wxItemAttr* wxTitleManagerList::OnGetItemAttr(long item) const
|
wxItemAttr* wxTitleManagerList::OnGetItemAttr(long item) const
|
||||||
{
|
{
|
||||||
const auto entry = GetTitleEntry(item);
|
static wxColour bgColourPrimary = GetBackgroundColour();
|
||||||
const wxColour kSecondColor{ 0xFDF9F2 };
|
static wxColour bgColourSecondary = wxHelper::CalculateAccentColour(bgColourPrimary);
|
||||||
static wxListItemAttr s_coloured_attr(GetTextColour(), kSecondColor, GetFont());
|
static wxListItemAttr s_primary_attr(GetTextColour(), bgColourPrimary, GetFont());
|
||||||
return item % 2 == 0 ? nullptr : &s_coloured_attr;
|
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)
|
boost::optional<wxTitleManagerList::TitleEntry&> wxTitleManagerList::GetTitleEntry(long item)
|
||||||
@ -1274,4 +1275,4 @@ void wxTitleManagerList::ClearItems()
|
|||||||
void wxTitleManagerList::AutosizeColumns()
|
void wxTitleManagerList::AutosizeColumns()
|
||||||
{
|
{
|
||||||
wxAutosizeColumns(this, ColumnTitleId, ColumnMAX - 1);
|
wxAutosizeColumns(this, ColumnTitleId, ColumnMAX - 1);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "input/emulated/EmulatedController.h"
|
#include "input/emulated/EmulatedController.h"
|
||||||
#include "input/api/Controller.h"
|
#include "input/api/Controller.h"
|
||||||
|
|
||||||
|
#include "gui/wxHelper.h"
|
||||||
|
|
||||||
class ControllerBase;
|
class ControllerBase;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
class wxComboBox;
|
class wxComboBox;
|
||||||
@ -12,9 +14,15 @@ class wxComboBox;
|
|||||||
class InputPanel : public wxPanel
|
class InputPanel : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
#if BOOST_OS_WINDOWS
|
||||||
const wxColour kKeyColourNormalMode = 0xfafafa;
|
const wxColour kKeyColourNormalMode = 0xfafafa;
|
||||||
const wxColour kKeyColourEditMode = 0x99ccff;
|
const wxColour kKeyColourEditMode = 0x99ccff;
|
||||||
const wxColour kKeyColourActiveMode = 0xE0E0E0;
|
const wxColour kKeyColourActiveMode = 0xE0E0E0;
|
||||||
|
#else
|
||||||
|
const wxColour kKeyColourNormalMode = GetBackgroundColour();
|
||||||
|
const wxColour kKeyColourEditMode = GetBackgroundColour();
|
||||||
|
const wxColour kKeyColourActiveMode = wxHelper::CalculateAccentColour(kKeyColourNormalMode);
|
||||||
|
#endif
|
||||||
|
|
||||||
InputPanel(wxWindow* parent);
|
InputPanel(wxWindow* parent);
|
||||||
|
|
||||||
|
@ -22,5 +22,16 @@ namespace wxHelper
|
|||||||
return wxString::FromUTF8(str.data(), str.size());
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user