Just in time for election day, here’s a snippet of code that performs a manipulation of the value dimension of an SWT color:
private Color colorWithValue(Color c, float value)
{
RGB rgb = c.getRGB();
float[] fs =
java.awt.Color.RGBtoHSB(rgb.red, rgb.green, rgb.blue, null);
java.awt.Color cc =
new java.awt.Color(java.awt.Color.HSBtoRGB(fs[0], fs[1], value));
return new Color(getDisplay(), cc.getRed(), cc.getGreen(), cc.getBlue());
}