diff --git a/cockatrice/src/interface/theme_icon.h b/cockatrice/src/interface/theme_icon.h index 716febd7a..231221c93 100644 --- a/cockatrice/src/interface/theme_icon.h +++ b/cockatrice/src/interface/theme_icon.h @@ -109,11 +109,6 @@ public: */ QColor resolve(QIcon::Mode mode) const; - IconEmphasis getEmphasis() const - { - return emphasis; - } - private: enum class Source { diff --git a/cockatrice/src/interface/theme_icon_ink.cpp b/cockatrice/src/interface/theme_icon_ink.cpp index 7d77ef948..1b0748091 100644 --- a/cockatrice/src/interface/theme_icon_ink.cpp +++ b/cockatrice/src/interface/theme_icon_ink.cpp @@ -62,9 +62,14 @@ QColor reachContrast(const QColor &color, const QColor &background, double minRa if (contrastRatio(color, background) >= minRatio) { return color; } - // Move away from the background: toward black on a light surface, toward - // white on a dark one. The hue is kept by interpolating, not by replacing. - const QColor pole = relativeLuminance(background) > 0.5 ? QColor(Qt::black) : QColor(Qt::white); + // Move away from the background: toward whichever pole actually reaches + // further. Black and white cross at a luminance of about 0.18, not 0.5, so + // the midpoint test would pick white on a surface where black is far more + // legible -- and could drag an ink that already cleared the floor to white. + // The hue is kept by interpolating, not by replacing. + const QColor black(Qt::black); + const QColor white(Qt::white); + const QColor pole = contrastRatio(black, background) >= contrastRatio(white, background) ? black : white; if (contrastRatio(pole, background) < minRatio) { return pole; } diff --git a/tests/theme_migration/theme_icon_render_test.cpp b/tests/theme_migration/theme_icon_render_test.cpp index c317c7e2f..f51282e0a 100644 --- a/tests/theme_migration/theme_icon_render_test.cpp +++ b/tests/theme_migration/theme_icon_render_test.cpp @@ -90,8 +90,8 @@ QColor expectedNeutralInk(const QPalette &palette) palette.color(QPalette::Active, QPalette::Highlight)); } -/** @brief Opaque pixels that are not the given rim color, i.e. the gradient fill. */ int -countOpaquePixelsOtherThan(const QPixmap &pixmap, const QColor &excluded) +/** @brief Opaque pixels that are not the given rim color, i.e. the gradient fill. */ +int countOpaquePixelsOtherThan(const QPixmap &pixmap, const QColor &excluded) { const QImage image = pixmap.toImage(); int count = 0;