Address review findings

This commit is contained in:
Lukas Brübach 2026-11-08 14:44:12 +01:00
parent dd5048e32c
commit 115d16a74b
3 changed files with 10 additions and 10 deletions

View file

@ -109,11 +109,6 @@ public:
*/
QColor resolve(QIcon::Mode mode) const;
IconEmphasis getEmphasis() const
{
return emphasis;
}
private:
enum class Source
{

View file

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

View file

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