mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 02:54:17 +01:00
Use system color definitions for wxGameList (#241)
Previously it would use hard-coded bright colors which clashed with dark themes on Linux
This commit is contained in:
parent
63206eb9a8
commit
6ef36152c2
@ -269,16 +269,42 @@ long wxGameList::GetStyleFlags(Style style) const
|
||||
|
||||
void wxGameList::UpdateItemColors(sint32 startIndex)
|
||||
{
|
||||
wxWindowUpdateLocker lock(this);
|
||||
for (int i = startIndex; i < GetItemCount(); ++i)
|
||||
{
|
||||
const auto titleId = (uint64)GetItemData(i);
|
||||
|
||||
wxWindowUpdateLocker lock(this);
|
||||
|
||||
// Get the background color so we can determine the theme in use
|
||||
const wxColour bgColour = GetBackgroundColour();
|
||||
|
||||
for (int i = startIndex; i < GetItemCount(); ++i)
|
||||
{
|
||||
const auto titleId = (uint64)GetItemData(i);
|
||||
if (GetConfig().IsGameListFavorite(titleId))//entry->favorite)
|
||||
{
|
||||
SetItemBackgroundColour(i, kFavoriteColor);
|
||||
SetItemTextColour(i, 0x000000UL);
|
||||
}
|
||||
else if ((i&1) != 0)
|
||||
SetItemBackgroundColour(i, kSecondColor);
|
||||
{
|
||||
// Depending on the background RGB value:
|
||||
// Light theme row color will be 10% darker (90)
|
||||
// Dark theme row color will be 10% brighter (110)
|
||||
int alpha = bgColour.GetRGB() > 0x808080 ? 90 : 110;
|
||||
SetItemBackgroundColour(i, bgColour.ChangeLightness(alpha));
|
||||
|
||||
// Text can be changed to other values for alternating rows if needed
|
||||
SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
}
|
||||
else
|
||||
SetItemBackgroundColour(i, 0xFFFFFFUL);
|
||||
{
|
||||
// Depending on the background RGB value:
|
||||
// Light theme row color will be 0% darker (100)
|
||||
// Dark theme row color will be 0% brighter (100)
|
||||
int alpha = bgColour.GetRGB() > 0x808080 ? 100 : 100;
|
||||
SetItemBackgroundColour(i, bgColour.ChangeLightness(alpha));
|
||||
|
||||
// Text color can be modified to other values for alternating rows if needed
|
||||
SetItemTextColour(i, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user