mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 20:13:24 -08:00
Address review findings
This commit is contained in:
parent
dd5048e32c
commit
115d16a74b
3 changed files with 10 additions and 10 deletions
|
|
@ -109,11 +109,6 @@ public:
|
|||
*/
|
||||
QColor resolve(QIcon::Mode mode) const;
|
||||
|
||||
IconEmphasis getEmphasis() const
|
||||
{
|
||||
return emphasis;
|
||||
}
|
||||
|
||||
private:
|
||||
enum class Source
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue