Change colors in XPInfoPanel to be brighter
This commit is contained in:
@@ -59,10 +59,6 @@ import org.pushingpixels.substance.internal.SubstanceSynapse;
|
|||||||
class XpInfoBox extends JPanel
|
class XpInfoBox extends JPanel
|
||||||
{
|
{
|
||||||
private static final Rectangle ICON_BOUNDS = new Rectangle(0, 0, 26, 26);
|
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 Client client;
|
||||||
private final JPanel panel;
|
private final JPanel panel;
|
||||||
@@ -138,6 +134,7 @@ class XpInfoBox extends JPanel
|
|||||||
|
|
||||||
// Create level label
|
// Create level label
|
||||||
levelLabel.setHorizontalAlignment(JLabel.CENTER);
|
levelLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
levelLabel.setForeground(Color.YELLOW);
|
||||||
levelLabel.setBounds(ICON_BOUNDS);
|
levelLabel.setBounds(ICON_BOUNDS);
|
||||||
levelLabel.setOpaque(false);
|
levelLabel.setOpaque(false);
|
||||||
|
|
||||||
@@ -233,7 +230,7 @@ class XpInfoBox extends JPanel
|
|||||||
final int progress = xpInfo.getSkillProgress();
|
final int progress = xpInfo.getSkillProgress();
|
||||||
|
|
||||||
progressBar.setValue(progress);
|
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("<html>"
|
progressBar.setToolTipText("<html>"
|
||||||
+ XpPanel.formatLine(xpInfo.getActions(), "actions")
|
+ XpPanel.formatLine(xpInfo.getActions(), "actions")
|
||||||
@@ -249,46 +246,6 @@ class XpInfoBox extends JPanel
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Interpolate between array of colors using Normal (Gaussian)
|
|
||||||
* distribution
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* <a href="https://en.wikipedia.org/wiki/Normal_distribution}">Normal
|
|
||||||
* distribution on Wikipedia</a>
|
|
||||||
* @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)
|
private static BufferedImage createHoverImage(BufferedImage image)
|
||||||
{
|
{
|
||||||
LookupTable lookup = new LookupTable(0, 4)
|
LookupTable lookup = new LookupTable(0, 4)
|
||||||
|
|||||||
Reference in New Issue
Block a user