Java examples for 2D Graphics:Color HSB
Converts from normal RGB color scheme to Java HSB.
//package com.java2s; import java.awt.Color; public class Main { /**/* ww w. j a va2 s . co m*/ * Converts from normal RGB colorscheme to Java HSB. * @param red The red value * @param green The green value * @param blue The blue value * @return The color in HSB format */ public static Color fromRGB(int red, int green, int blue) { float[] hsb = Color.RGBtoHSB(red, green, blue, null); return Color.getHSBColor(hsb[0], hsb[1], hsb[2]); } }