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

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