Fix Logo Color for Dark Theme

This commit is contained in:
Florian Märkl 2018-12-24 16:12:08 +01:00
parent c92ed51b65
commit 8241b09e80
2 changed files with 20 additions and 1 deletions

View File

@ -127,7 +127,15 @@ void Configuration::setLocale(const QLocale &l)
bool Configuration::windowColorIsDark()
{
auto windowColor = QPalette().color(QPalette::Window).toRgb();
ColorFlags currentThemeColorFlags = getCurrentTheme()->flag;
if (currentThemeColorFlags == ColorFlags::LightFlag) {
return false;
} else if (currentThemeColorFlags == ColorFlags::DarkFlag) {
return true;
}
const QPalette &palette = qApp->palette();
auto windowColor = palette.color(QPalette::Window).toRgb();
return (windowColor.red() + windowColor.green() + windowColor.blue()) < 382;
}
@ -276,6 +284,15 @@ void Configuration::setTheme(int theme)
emit colorsUpdated();
}
const CutterQtTheme *Configuration::getCurrentTheme()
{
int i = getTheme();
if (i < 0 || i >= kCutterQtThemesList.size()) {
i = 0;
setTheme(i);
}
return &kCutterQtThemesList[i];
}
QString Configuration::getLogoFile()
{

View File

@ -65,6 +65,8 @@ public:
return s.value("ColorPalette", 0).toInt();
}
const CutterQtTheme *getCurrentTheme();
QString getDirProjects();
void setDirProjects(const QString &dir);