From 9634eb8e06a2e163f515c65913dc8fc27884b89c Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 9 Jun 2018 03:09:21 +0100 Subject: [PATCH] Make Color config options show their colour instead of "Pick a color" (#3583) - Make Color config options show their colour instead of "Pick a color" - Made null Colors show "Pick a color" --- .../client/plugins/config/ConfigPanel.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 320bb84c48..a83d0495eb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -505,9 +505,21 @@ public class ConfigPanel extends PluginPanel if (cid.getType() == Color.class) { String existing = configManager.getConfiguration(cd.getGroup().keyName(), cid.getItem().keyName()); - Color existingColor = existing == null ? Color.BLACK : Color.decode(existing); - JButton colorPicker = new JButton("Pick a color"); + Color existingColor; + JButton colorPicker; + + if (existing == null) + { + existingColor = Color.BLACK; + colorPicker = new JButton("Pick a color"); + } + else + { + existingColor = Color.decode(existing); + colorPicker = new JButton("#" + Integer.toHexString(existingColor.getRGB()).substring(2).toUpperCase()); + } + colorPicker.setFocusable(false); colorPicker.setBackground(existingColor); colorPicker.addMouseListener(new MouseAdapter()