Here you can find the source of findHue(Color color)
Parameter | Description |
---|---|
color | The color to match. |
public static float findHue(Color color)
//package com.java2s; import java.awt.Color; public class Main { /**/* ww w . ja va 2 s . c om*/ * Finds the closest hue possible to given color. * * @param color * The color to match. * @return Hue float value between 0 and 1. */ public static float findHue(Color color) { float[] hsbvals = new float[3]; Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsbvals); return hsbvals[0]; } }