refactor: ColorUtils::colorIsDark

make it more clear
This commit is contained in:
hexyoungs
2020-09-28 10:24:21 +08:00
committed by borgmanJeremy
parent f2101a3296
commit 01bc618dcc

View File

@@ -24,11 +24,8 @@ inline qreal getColorLuma(const QColor& c)
bool ColorUtils::colorIsDark(const QColor& c)
{
bool isWhite = false;
if (getColorLuma(c) <= 0.60) {
isWhite = true;
}
return !isWhite;
// when luma <= 0.5, we considor it as a dark color
return getColorLuma(c) <= 0.5;
}
QColor ColorUtils::contrastColor(const QColor& c)