Java HSL Color Convert findHue(Color color)

Here you can find the source of findHue(Color color)

Description

Finds the closest hue possible to given color.

License

Open Source License

Parameter

Parameter Description
color The color to match.

Return

Hue float value between 0 and 1.

Declaration

public static float findHue(Color color) 

Method Source Code

//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];
    }
}

Related

  1. hsl2hex(int[] hsl)
  2. hsl2rgb(double h, double s, double l)
  3. hsl2rgb(float h, float s, float l)
  4. hsl2rgb(int[] hsl)