I have a problem here - I have a hexadecimal value being stored in a textfield after I have selected a color (using JColorChooser). What I would like to do is display the
RGB is not a very best color model to work with in this situation. HSB would be more appropriate.
Convert RGB to HSB:
float[] hsb = Color.RGBtoHSB(red, green, blue, null);
Detect color:
String color;
if (hsb[0] >= 0.0 && ksb[0] <= 0.1) {
color = "Red";
} else if (hsb[0] > 0.1 && ksb[0] <= 0.25) {
color = "Orange";
} else if (hsb[0] > 0.25 && ksb[0] <= 0.35) {
color = "Yellow";
} ...