diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index cee1e2a67d..94e7d88535 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -59,10 +59,6 @@ import org.pushingpixels.substance.internal.SubstanceSynapse; class XpInfoBox extends JPanel { private static final Rectangle ICON_BOUNDS = new Rectangle(0, 0, 26, 26); - private static final Color[] PROGRESS_COLORS = new Color[] - { - Color.RED, Color.YELLOW, Color.GREEN - }; private final Client client; private final JPanel panel; @@ -138,6 +134,7 @@ class XpInfoBox extends JPanel // Create level label levelLabel.setHorizontalAlignment(JLabel.CENTER); + levelLabel.setForeground(Color.YELLOW); levelLabel.setBounds(ICON_BOUNDS); levelLabel.setOpaque(false); @@ -233,7 +230,7 @@ class XpInfoBox extends JPanel final int progress = xpInfo.getSkillProgress(); progressBar.setValue(progress); - progressBar.setBackground(interpolateColors(PROGRESS_COLORS, (double) progress / 100d)); + progressBar.setBackground(Color.getHSBColor((progress / 100.f) * (120.f / 360.f), 1, 1)); progressBar.setToolTipText("" + XpPanel.formatLine(xpInfo.getActions(), "actions") @@ -249,46 +246,6 @@ class XpInfoBox extends JPanel }); } - /** - * Interpolate between array of colors using Normal (Gaussian) - * distribution - * - * @see - * Normal - * distribution on Wikipedia - * @param colors array of colors - * @param x distribution factor - * @return interpolated color - */ - private static Color interpolateColors(Color[] colors, double x) - { - double r = 0.0, g = 0.0, b = 0.0; - double total = 0.0; - double step = 1.0 / (double) (colors.length - 1); - double mu = 0.0; - double sigma2 = 0.035; - - for (Color ignored : colors) - { - total += Math.exp(-(x - mu) * (x - mu) / (2.0 * sigma2)) / Math.sqrt(2.0 * Math.PI * sigma2); - mu += step; - } - - mu = 0.0; - - for (Color color : colors) - { - double percent = Math.exp(-(x - mu) * (x - mu) / (2.0 * sigma2)) / Math.sqrt(2.0 * Math.PI * sigma2); - mu += step; - - r += color.getRed() * percent / total; - g += color.getGreen() * percent / total; - b += color.getBlue() * percent / total; - } - - return new Color((int) r, (int) g, (int) b); - } - private static BufferedImage createHoverImage(BufferedImage image) { LookupTable lookup = new LookupTable(0, 4)