mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 21:40:00 -08:00
Preserve readable colors for non-Essence categories in shared chart components
This commit is contained in:
parent
f0adc0eaa6
commit
781f37b2a4
1 changed files with 7 additions and 1 deletions
|
|
@ -20,7 +20,13 @@ inline QColor colorFor(const QString &code)
|
||||||
}
|
}
|
||||||
const int index = Essence::symbols().indexOf(code);
|
const int index = Essence::symbols().indexOf(code);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return QColor(145, 149, 156);
|
// These charts are also reused for card types/categories. Retain
|
||||||
|
// distinct readable visualization colors without assigning Essence lore.
|
||||||
|
const QColor recognizedColor(code);
|
||||||
|
if (recognizedColor.isValid()) {
|
||||||
|
return recognizedColor;
|
||||||
|
}
|
||||||
|
return QColor::fromHsv(static_cast<int>(qHash(code) % 360u), 110, 195);
|
||||||
}
|
}
|
||||||
return QColor::fromHsv((index * 137) % 360, 125, 210);
|
return QColor::fromHsv((index * 137) % 360, 125, 210);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue