Fix various colour values for dark themes (#439)

This commit is contained in:
goeiecool9999 2022-11-13 08:27:09 +01:00 committed by GitHub
parent 94b179ef5a
commit 2842615edb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 17 deletions

View file

@ -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();
}
}