mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 12:33:25 -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;
|
QColor resolve(QIcon::Mode mode) const;
|
||||||
|
|
||||||
IconEmphasis getEmphasis() const
|
|
||||||
{
|
|
||||||
return emphasis;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Source
|
enum class Source
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,14 @@ QColor reachContrast(const QColor &color, const QColor &background, double minRa
|
||||||
if (contrastRatio(color, background) >= minRatio) {
|
if (contrastRatio(color, background) >= minRatio) {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
// Move away from the background: toward black on a light surface, toward
|
// Move away from the background: toward whichever pole actually reaches
|
||||||
// white on a dark one. The hue is kept by interpolating, not by replacing.
|
// further. Black and white cross at a luminance of about 0.18, not 0.5, so
|
||||||
const QColor pole = relativeLuminance(background) > 0.5 ? QColor(Qt::black) : QColor(Qt::white);
|
// 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) {
|
if (contrastRatio(pole, background) < minRatio) {
|
||||||
return pole;
|
return pole;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@ QColor expectedNeutralInk(const QPalette &palette)
|
||||||
palette.color(QPalette::Active, QPalette::Highlight));
|
palette.color(QPalette::Active, QPalette::Highlight));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Opaque pixels that are not the given rim color, i.e. the gradient fill. */ int
|
/** @brief Opaque pixels that are not the given rim color, i.e. the gradient fill. */
|
||||||
countOpaquePixelsOtherThan(const QPixmap &pixmap, const QColor &excluded)
|
int countOpaquePixelsOtherThan(const QPixmap &pixmap, const QColor &excluded)
|
||||||
{
|
{
|
||||||
const QImage image = pixmap.toImage();
|
const QImage image = pixmap.toImage();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue