In JavaScript I have used the JQuery plugin xcolor, which is a fantastic little tool for working with colors. It has color string parsers, all the color space conversion methods, a few color filters, and my favorite, a gradient generator (see $.xcolor.gradientlevel()).
I’m looking for something similar in Java. Other bonuses would be falsecolor routines (convert a number to a color – a powerful one would have parameters like max/min cutoff and log vs. linear scales) and color schemes (like red -> orange -> yellow -> green gradient generator).
Are there any free libraries out there that can do some of these things in Java or is this something I have to roll myself? I haven’t found much from my googling except for some things in AWT, but I need it to be generic because I’m not working with any Java GUI stuff at all.
Java’s Color class should work fine:
Gradients:
http://docs.oracle.com/javase/6/docs/api/java/awt/GradientPaint.html
Generating gradients programmatically?
Hue Saturation:
Color.getHSBColor(hue, saturation, brightness)