mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Improve and standardize rarity colors
This commit is contained in:
@@ -21,7 +21,7 @@ package forge.gui;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardCharacteristicName;
|
import forge.card.CardCharacteristicName;
|
||||||
import forge.card.CardDetailUtil;
|
import forge.card.CardDetailUtil;
|
||||||
import forge.card.CardDetailUtil.CardBorderColor;
|
import forge.card.CardDetailUtil.DetailColors;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
@@ -49,7 +49,9 @@ public class CardDetailPanel extends SkinnedPanel {
|
|||||||
/** Constant <code>serialVersionUID=-8461473263764812323L</code>. */
|
/** Constant <code>serialVersionUID=-8461473263764812323L</code>. */
|
||||||
private static final long serialVersionUID = -8461473263764812323L;
|
private static final long serialVersionUID = -8461473263764812323L;
|
||||||
|
|
||||||
private static Color purple = new Color(14381203);
|
private static Color fromDetailColor(DetailColors detailColor) {
|
||||||
|
return new Color(detailColor.r, detailColor.g, detailColor.b);
|
||||||
|
}
|
||||||
|
|
||||||
private final FLabel nameCostLabel;
|
private final FLabel nameCostLabel;
|
||||||
private final FLabel typeLabel;
|
private final FLabel typeLabel;
|
||||||
@@ -203,40 +205,36 @@ public class CardDetailPanel extends SkinnedPanel {
|
|||||||
else {
|
else {
|
||||||
setInfoLabel.setToolTipText(String.format("%s (%s)", edition.getName(), card.getRarity().name()));
|
setInfoLabel.setToolTipText(String.format("%s (%s)", edition.getName(), card.getRarity().name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setInfoLabel.setOpaque(true);
|
this.setInfoLabel.setOpaque(true);
|
||||||
|
|
||||||
|
Color backColor;
|
||||||
switch(card.getRarity()) {
|
switch(card.getRarity()) {
|
||||||
case Uncommon:
|
case Uncommon:
|
||||||
this.setInfoLabel.setBackground(Color.LIGHT_GRAY);
|
backColor = fromDetailColor(DetailColors.UNCOMMON);
|
||||||
this.setInfoLabel.setForeground(Color.BLACK);
|
|
||||||
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Rare:
|
case Rare:
|
||||||
this.setInfoLabel.setBackground(Color.YELLOW);
|
backColor = fromDetailColor(DetailColors.RARE);
|
||||||
this.setInfoLabel.setForeground(Color.BLACK);
|
|
||||||
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MythicRare:
|
case MythicRare:
|
||||||
this.setInfoLabel.setBackground(Color.RED);
|
backColor = fromDetailColor(DetailColors.MYTHIC);
|
||||||
this.setInfoLabel.setForeground(Color.BLACK);
|
|
||||||
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Special:
|
case Special: //"Timeshifted" or other Special Rarity Cards
|
||||||
// "Timeshifted" or other Special Rarity Cards
|
backColor = fromDetailColor(DetailColors.SPECIAL);
|
||||||
this.setInfoLabel.setBackground(CardDetailPanel.purple);
|
|
||||||
this.setInfoLabel.setForeground(Color.BLACK);
|
|
||||||
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: //case BasicLand: + case Common:
|
default: //case BasicLand: + case Common:
|
||||||
this.setInfoLabel.setBackground(Color.BLACK);
|
backColor = fromDetailColor(DetailColors.COMMON);
|
||||||
this.setInfoLabel.setForeground(Color.WHITE);
|
|
||||||
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color foreColor = FSkin.getHighContrastColor(backColor);
|
||||||
|
this.setInfoLabel.setBackground(backColor);
|
||||||
|
this.setInfoLabel.setForeground(foreColor);
|
||||||
|
this.setInfoLabel.setBorder(BorderFactory.createLineBorder(foreColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +288,7 @@ public class CardDetailPanel extends SkinnedPanel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardBorderColor borderColor = CardDetailUtil.getBorderColor(card, canShow);
|
Color color = fromDetailColor(CardDetailUtil.getBorderColor(card, canShow));
|
||||||
Color color = new Color(borderColor.r, borderColor.g, borderColor.b);
|
|
||||||
this.setBorder(BorderFactory.createLineBorder(color, 2));
|
this.setBorder(BorderFactory.createLineBorder(color, 2));
|
||||||
scrArea.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, color));
|
scrArea.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, color));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import forge.assets.FSkinImage;
|
|||||||
import forge.assets.ImageCache;
|
import forge.assets.ImageCache;
|
||||||
import forge.assets.FSkinColor.Colors;
|
import forge.assets.FSkinColor.Colors;
|
||||||
import forge.card.CardDetailUtil;
|
import forge.card.CardDetailUtil;
|
||||||
import forge.card.CardDetailUtil.CardBorderColor;
|
import forge.card.CardDetailUtil.DetailColors;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.match.input.Input;
|
import forge.match.input.Input;
|
||||||
@@ -469,8 +469,8 @@ public class InputSelectCard {
|
|||||||
h -= 2 * blackBorderThickness;
|
h -= 2 * blackBorderThickness;
|
||||||
|
|
||||||
//determine colors for borders
|
//determine colors for borders
|
||||||
List<CardBorderColor> borderColors = CardDetailUtil.getBorderColors(card, canShow, true);
|
List<DetailColors> borderColors = CardDetailUtil.getBorderColors(card, canShow, true);
|
||||||
CardBorderColor borderColor = borderColors.get(0);
|
DetailColors borderColor = borderColors.get(0);
|
||||||
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
Color color1 = FSkinColor.fromRGB(borderColor.r, borderColor.g, borderColor.b);
|
||||||
Color color2 = null;
|
Color color2 = null;
|
||||||
if (borderColors.size() > 1) {
|
if (borderColors.size() > 1) {
|
||||||
@@ -490,7 +490,7 @@ public class InputSelectCard {
|
|||||||
x += outerBorderThickness;
|
x += outerBorderThickness;
|
||||||
y += outerBorderThickness;
|
y += outerBorderThickness;
|
||||||
w -= 2 * outerBorderThickness;
|
w -= 2 * outerBorderThickness;
|
||||||
h = Math.max(MANA_SYMBOL_SIZE + 2 * MANA_COST_PADDING, 2 * NAME_FONT.getFont().getCapHeight()) + 2 * TYPE_FONT.getFont().getCapHeight();
|
h = Math.max(MANA_SYMBOL_SIZE + 2 * MANA_COST_PADDING, 2 * NAME_FONT.getFont().getCapHeight()) + 2 * TYPE_FONT.getFont().getCapHeight() + 2;
|
||||||
|
|
||||||
//draw name/type box
|
//draw name/type box
|
||||||
int nameManaCostStep = 100; //TODO: add better background colors to CardBorderColor enum
|
int nameManaCostStep = 100; //TODO: add better background colors to CardBorderColor enum
|
||||||
@@ -552,13 +552,15 @@ public class InputSelectCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void drawCardIdAndPtBox(Graphics g, Card card, Color idForeColor, Color color1, Color color2, float x, float y, float w, float h) {
|
private static void drawCardIdAndPtBox(Graphics g, Card card, Color idForeColor, Color color1, Color color2, float x, float y, float w, float h) {
|
||||||
g.drawText(CardDetailUtil.formatCardId(card), ID_FONT, idForeColor, x, y + ID_FONT.getFont().getCapHeight() / 2, w, h, false, HAlignment.LEFT, false);
|
String idText = CardDetailUtil.formatCardId(card);
|
||||||
|
g.drawText(idText, ID_FONT, idForeColor, x, y + ID_FONT.getFont().getCapHeight() / 2, w, h, false, HAlignment.LEFT, false);
|
||||||
|
|
||||||
String text = CardDetailUtil.formatPowerToughness(card);
|
String ptText = CardDetailUtil.formatPowerToughness(card);
|
||||||
if (StringUtils.isEmpty(text)) { return; }
|
if (StringUtils.isEmpty(ptText)) { return; }
|
||||||
|
|
||||||
float padding = PT_FONT.getFont().getCapHeight() / 2;
|
float padding = PT_FONT.getFont().getCapHeight() / 2;
|
||||||
float boxWidth = PT_FONT.getFont().getBounds(text).width + 2 * padding;
|
float boxWidth = Math.min(PT_FONT.getFont().getBounds(ptText).width + 2 * padding,
|
||||||
|
w - ID_FONT.getFont().getBounds(idText).width - padding); //prevent box overlapping ID
|
||||||
x += w - boxWidth;
|
x += w - boxWidth;
|
||||||
w = boxWidth;
|
w = boxWidth;
|
||||||
|
|
||||||
@@ -569,7 +571,7 @@ public class InputSelectCard {
|
|||||||
g.fillGradientRect(color1, color2, false, x, y, w, h);
|
g.fillGradientRect(color1, color2, false, x, y, w, h);
|
||||||
}
|
}
|
||||||
g.drawRect(1, Color.BLACK, x, y, w, h);
|
g.drawRect(1, Color.BLACK, x, y, w, h);
|
||||||
g.drawText(text, PT_FONT, Color.BLACK, x, y, w, h, false, HAlignment.CENTER, true);
|
g.drawText(ptText, PT_FONT, Color.BLACK, x, y, w, h, false, HAlignment.CENTER, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class CardDetailUtil {
|
|||||||
private CardDetailUtil() {
|
private CardDetailUtil() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CardBorderColor {
|
public enum DetailColors {
|
||||||
WHITE(254, 253, 244),
|
WHITE(254, 253, 244),
|
||||||
BLUE(90, 146, 202),
|
BLUE(90, 146, 202),
|
||||||
BLACK(32, 34, 31),
|
BLACK(32, 34, 31),
|
||||||
@@ -29,105 +29,110 @@ public class CardDetailUtil {
|
|||||||
COLORLESS(160, 166, 164),
|
COLORLESS(160, 166, 164),
|
||||||
LAND(190, 153, 112),
|
LAND(190, 153, 112),
|
||||||
FACE_DOWN(83, 61, 40),
|
FACE_DOWN(83, 61, 40),
|
||||||
|
COMMON(10, 7, 10),
|
||||||
|
UNCOMMON(160, 172, 174),
|
||||||
|
RARE(193, 170, 100),
|
||||||
|
MYTHIC(171, 54, 39),
|
||||||
|
SPECIAL(141, 114, 147),
|
||||||
UNKNOWN(200, 0, 230);
|
UNKNOWN(200, 0, 230);
|
||||||
|
|
||||||
public final int r, g, b;
|
public final int r, g, b;
|
||||||
|
|
||||||
private CardBorderColor(int r0, int g0, int b0) {
|
private DetailColors(int r0, int g0, int b0) {
|
||||||
r = r0;
|
r = r0;
|
||||||
g = g0;
|
g = g0;
|
||||||
b = b0;
|
b = b0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CardBorderColor getBorderColor(final Card card, boolean canShow) {
|
public static DetailColors getBorderColor(final Card card, boolean canShow) {
|
||||||
return getBorderColors(card, canShow, false).get(0);
|
return getBorderColors(card, canShow, false).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CardBorderColor> getBorderColors(final Card card, boolean canShow, boolean supportMultiple) {
|
public static List<DetailColors> getBorderColors(final Card card, boolean canShow, boolean supportMultiple) {
|
||||||
List<CardBorderColor> borderColors = new ArrayList<CardBorderColor>();
|
List<DetailColors> borderColors = new ArrayList<DetailColors>();
|
||||||
ColorSet cardColors = card.determineColor();
|
ColorSet cardColors = card.determineColor();
|
||||||
|
|
||||||
if (!canShow) {
|
if (!canShow) {
|
||||||
borderColors.add(CardBorderColor.FACE_DOWN);
|
borderColors.add(DetailColors.FACE_DOWN);
|
||||||
}
|
}
|
||||||
else if (cardColors.isColorless()) {
|
else if (cardColors.isColorless()) {
|
||||||
if (card.isLand()) { //use different color for lands vs. other colorless cards
|
if (card.isLand()) { //use different color for lands vs. other colorless cards
|
||||||
borderColors.add(CardBorderColor.LAND);
|
borderColors.add(DetailColors.LAND);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
borderColors.add(CardBorderColor.COLORLESS);
|
borderColors.add(DetailColors.COLORLESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int colorCount = cardColors.countColors();
|
int colorCount = cardColors.countColors();
|
||||||
if (colorCount > 2 || (colorCount > 1 && !supportMultiple)) {
|
if (colorCount > 2 || (colorCount > 1 && !supportMultiple)) {
|
||||||
borderColors.add(CardBorderColor.MULTICOLOR);
|
borderColors.add(DetailColors.MULTICOLOR);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasWhite()) {
|
else if (cardColors.hasWhite()) {
|
||||||
if (colorCount == 1) {
|
if (colorCount == 1) {
|
||||||
borderColors.add(CardBorderColor.WHITE);
|
borderColors.add(DetailColors.WHITE);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasBlue()) {
|
else if (cardColors.hasBlue()) {
|
||||||
borderColors.add(CardBorderColor.WHITE);
|
borderColors.add(DetailColors.WHITE);
|
||||||
borderColors.add(CardBorderColor.BLUE);
|
borderColors.add(DetailColors.BLUE);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasBlack()) {
|
else if (cardColors.hasBlack()) {
|
||||||
borderColors.add(CardBorderColor.WHITE);
|
borderColors.add(DetailColors.WHITE);
|
||||||
borderColors.add(CardBorderColor.BLACK);
|
borderColors.add(DetailColors.BLACK);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasRed()) {
|
else if (cardColors.hasRed()) {
|
||||||
borderColors.add(CardBorderColor.RED);
|
borderColors.add(DetailColors.RED);
|
||||||
borderColors.add(CardBorderColor.WHITE);
|
borderColors.add(DetailColors.WHITE);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasGreen()) {
|
else if (cardColors.hasGreen()) {
|
||||||
borderColors.add(CardBorderColor.GREEN);
|
borderColors.add(DetailColors.GREEN);
|
||||||
borderColors.add(CardBorderColor.WHITE);
|
borderColors.add(DetailColors.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cardColors.hasBlue()) {
|
else if (cardColors.hasBlue()) {
|
||||||
if (colorCount == 1) {
|
if (colorCount == 1) {
|
||||||
borderColors.add(CardBorderColor.BLUE);
|
borderColors.add(DetailColors.BLUE);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasBlack()) {
|
else if (cardColors.hasBlack()) {
|
||||||
borderColors.add(CardBorderColor.BLUE);
|
borderColors.add(DetailColors.BLUE);
|
||||||
borderColors.add(CardBorderColor.BLACK);
|
borderColors.add(DetailColors.BLACK);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasRed()) {
|
else if (cardColors.hasRed()) {
|
||||||
borderColors.add(CardBorderColor.BLUE);
|
borderColors.add(DetailColors.BLUE);
|
||||||
borderColors.add(CardBorderColor.RED);
|
borderColors.add(DetailColors.RED);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasGreen()) {
|
else if (cardColors.hasGreen()) {
|
||||||
borderColors.add(CardBorderColor.GREEN);
|
borderColors.add(DetailColors.GREEN);
|
||||||
borderColors.add(CardBorderColor.BLUE);
|
borderColors.add(DetailColors.BLUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cardColors.hasBlack()) {
|
else if (cardColors.hasBlack()) {
|
||||||
if (colorCount == 1) {
|
if (colorCount == 1) {
|
||||||
borderColors.add(CardBorderColor.BLACK);
|
borderColors.add(DetailColors.BLACK);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasRed()) {
|
else if (cardColors.hasRed()) {
|
||||||
borderColors.add(CardBorderColor.BLACK);
|
borderColors.add(DetailColors.BLACK);
|
||||||
borderColors.add(CardBorderColor.RED);
|
borderColors.add(DetailColors.RED);
|
||||||
}
|
}
|
||||||
else if (cardColors.hasGreen()) {
|
else if (cardColors.hasGreen()) {
|
||||||
borderColors.add(CardBorderColor.BLACK);
|
borderColors.add(DetailColors.BLACK);
|
||||||
borderColors.add(CardBorderColor.GREEN);
|
borderColors.add(DetailColors.GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cardColors.hasRed()) { //if we got this far, must be mono-red or red-green
|
else if (cardColors.hasRed()) { //if we got this far, must be mono-red or red-green
|
||||||
borderColors.add(CardBorderColor.RED);
|
borderColors.add(DetailColors.RED);
|
||||||
if (cardColors.hasGreen()) {
|
if (cardColors.hasGreen()) {
|
||||||
borderColors.add(CardBorderColor.GREEN);
|
borderColors.add(DetailColors.GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cardColors.hasGreen()) { //if we got this far, must be mono-green
|
else if (cardColors.hasGreen()) { //if we got this far, must be mono-green
|
||||||
borderColors.add(CardBorderColor.GREEN);
|
borderColors.add(DetailColors.GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (borderColors.isEmpty()) { // If your card has a violet border, something is wrong
|
if (borderColors.isEmpty()) { // If your card has a violet border, something is wrong
|
||||||
borderColors.add(CardBorderColor.UNKNOWN);
|
borderColors.add(DetailColors.UNKNOWN);
|
||||||
}
|
}
|
||||||
return borderColors;
|
return borderColors;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user