From 9051fbf92e8aeb14b05021fc8aab7f76712868d0 Mon Sep 17 00:00:00 2001 From: Seth Date: Sat, 27 Jan 2018 00:57:05 -0600 Subject: [PATCH] Add custom colors to ground items --- .../grounditems/GroundItemsConfig.java | 52 +++++++++++++++++++ .../grounditems/GroundItemsOverlay.java | 16 ++---- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java index af4d12a1a0..1148ab94da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java @@ -29,6 +29,8 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import java.awt.Color; + @ConfigGroup( keyName = "grounditems", name = "Ground Items", @@ -105,4 +107,54 @@ public interface GroundItemsConfig extends Config { return 0; } + + @ConfigItem( + keyName = "highlightedColor", + name = "Highlighted items color", + description = "Configures the color for highlighted items" + ) + default Color highlightedColor() + { + return Color.decode("#AA00FF"); + } + + @ConfigItem( + keyName = "lowValueColor", + name = "Low value items color", + description = "Configures the color for low value items" + ) + default Color lowValueColor() + { + return Color.decode("#66B2FF"); + } + + @ConfigItem( + keyName = "mediumValueColor", + name = "Medium value items color", + description = "Configures the color for medium value items" + ) + default Color mediumValueColor() + { + return Color.decode("#99FF99"); + } + + @ConfigItem( + keyName = "highValueColor", + name = "High value items color", + description = "Configures the color for high value items" + ) + default Color highValueColor() + { + return Color.decode("#FF9600"); + } + + @ConfigItem( + keyName = "insaneValueColor", + name = "Insane value items color", + description = "Configures the color for insane value items" + ) + default Color insaneValueColor() + { + return Color.decode("#FF66B2"); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index f687555877..4c56876419 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -66,18 +66,12 @@ public class GroundItemsOverlay extends Overlay private static final int STRING_GAP = 15; // Threshold for highlighting items as blue. private static final int LOW_VALUE = 20_000; - private static final Color BRIGHT_BLUE = new Color(102, 178, 255); // Threshold for highlighting items as green. private static final int MEDIUM_VALUE = 100_000; - private static final Color BRIGHT_GREEN = new Color(153, 255, 153); // Threshold for highlighting items as amber. private static final int HIGH_VALUE = 1_000_000; - private static final Color AMBER = new Color(255, 150, 0); // Threshold for highlighting items as pink. private static final int INSANE_VALUE = 10_000_000; - private static final Color FADED_PINK = new Color(255, 102, 178); - // Color to use if an item is highlighted in the config. - private static final Color PURPLE = new Color(170, 0, 255); // Used when getting High Alchemy value - multiplied by general store price. private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; // Regex for splitting the hidden items in the config. @@ -271,19 +265,19 @@ public class GroundItemsOverlay extends Overlay // set the color according to rarity, if possible if (cost >= INSANE_VALUE) // 10,000,000 gp { - textColor = FADED_PINK; + textColor = config.insaneValueColor(); } else if (cost >= HIGH_VALUE) // 1,000,000 gp { - textColor = AMBER; + textColor = config.highValueColor(); } else if (cost >= MEDIUM_VALUE) // 100,000 gp { - textColor = BRIGHT_GREEN; + textColor = config.mediumValueColor(); } else if (cost >= LOW_VALUE) // 20,000 gp { - textColor = BRIGHT_BLUE; + textColor = config.lowValueColor(); } itemStringBuilder.append(" (EX: ") @@ -300,7 +294,7 @@ public class GroundItemsOverlay extends Overlay if (highlightedItems.contains(item.getName().toLowerCase())) { - textColor = PURPLE; + textColor = config.highlightedColor(); } String itemString = itemStringBuilder.toString();