Converts HSV color system to RGB
@param h hue 0-360
@param s saturation 0-100
@param v value 0-100
@return RGB values in LibGDX {@link Color} class
486402
public static Color HSVtoRGB (float h, float s, float v) {
		Color c = new Color(1, 1, 1, 1);
		HSVtoRGB(h, s, v, c);
		return c;
	}
984342
public static RgbaColor fromHsla(String hsl) {
        String[] parts = getHslaParts(hsl).split(",");
        if (parts.length == 4) {
            float[] HSL = new float[] { parseInt(parts[0]), parseInt(parts[1]), parseInt(parts[2]) };
            RgbaColor ret = fromHsl(HSL);
            if (ret != null) {
                ret.a = parseFloat(parts[3]);
            }
            return ret;
        }
        else {
            return getDefaultColor();
        }
    }
1165974
public static void rgbToHsv_F32(Planar<GrayF32> rgb , Planar<GrayF32> hsv ) {
		GrayF32 R = rgb.getBand(0);
		GrayF32 G = rgb.getBand(1);
		GrayF32 B = rgb.getBand(2);

		GrayF32 H = hsv.getBand(0);
		GrayF32 S = hsv.getBand(1);
		GrayF32 V = hsv.getBand(2);

		//CONCURRENT_BELOW BoofConcurrency.loopFor(0,hsv.height,row->{
		for( int row = 0; row < hsv.height; row++ ) {
			int indexRgb = rgb.startIndex + row*rgb.stride;
			int indexHsv = hsv.startIndex + row*hsv.stride;
			int endRgb = indexRgb+hsv.width;

			for( ; indexRgb < endRgb; indexHsv++ , indexRgb++) {

				float r = R.data[indexRgb];
				float g = G.data[indexRgb];
				float b = B.data[indexRgb];

				float max = r > g ? ( r > b ? r : b) : ( g > b ? g : b );
				float min = r < g ? ( r < b ? r : b) : ( g < b ? g : b );

				float delta = max - min;

				V.data[indexHsv] = max;

				if( max != 0 )
					S.data[indexHsv] = delta / max;
				else {
					H.data[indexHsv] = Float.NaN;
					S.data[indexHsv] = 0;
					continue;
				}

				float h;
				if( r == max )
					h = ( g - b ) / delta;
				else if( g == max )
					h = 2 + ( b - r ) / delta;
				else
					h = 4 + ( r - g ) / delta;

				h *= d60_F32;
				if( h < 0 )
					h += PI2_F32;

				H.data[indexHsv] = h;
			}
		}
		//CONCURRENT_ABOVE });
	}
884610
public static int getDisplayColorFromColor(int color) {
        if (!isJellybeanOrLater()) {
            return color;
        }

        float[] hsv = new float[3];
        Color.colorToHSV(color, hsv);
        hsv[1] = Math.min(hsv[1] * SATURATION_ADJUST, 1.0f);
        hsv[2] = hsv[2] * INTENSITY_ADJUST;
        return Color.HSVToColor(hsv);
    }
1242321
public static function hsv($h,$s,$v,$a=1)
	{
		$self = new self();
		return $self->h($h)->s($s)->v($v)->a($a);
	}
943202
public static int[] RGBtoHSV (Color c) {
		return RGBtoHSV(c.r, c.g, c.b);
	}
616459
def from_hsv(cls, h, s, v):
        """"""
        rgb = colorsys.hsv_to_rgb(h, s, v)
        return cls.from_rgb(*(int(x * 255) for x in rgb))
56650
def _hue(color, **kwargs):
    
    h = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[0]
    return NumberValue(h * 360.0)
103022
def hsl_to_rgb(h, s, l)
      h %= 201
      s %= 101
      l %= 101
      if l <= 49
        color_max = 255.0 * (l + l * (s / 100.0)) / 100.0
        color_min = 255.0 * (l - l * (s / 100.0)) / 100.0
      else
        color_max = 255.0 * (l + (100 - l) * (s / 100.0)) / 100.0
        color_min = 255.0 * (l - (100 - l) * (s / 100.0)) / 100.0
      end

      if h < HUE_PER_6
        base = h
      elsif h < HUE_PER_6 * 3
        base = (h - HUE_PER_6 * 2).abs
      elsif h < HUE_PER_6 * 5
        base = (h - HUE_PER_6 * 4).abs
      else
        base = (200 - h)
      end
      base = base / HUE_PER_6 * (color_max - color_min) + color_min

      divide = (h / HUE_PER_6).to_i
      red, green, blue = (case divide
                          when 0 then  [color_max, base, color_min]
                          when 1 then  [base, color_max, color_min]
                          when 2 then  [color_min, color_max, base]
                          when 3 then  [color_min, base, color_max]
                          when 4 then  [base, color_min, color_max]
                          else         [color_max, color_min, base]
                          end)

      [red.round, green.round, blue.round]
    end
976461
public static void rgbToHsv( float r , float g , float b , float []hsv ) {
		// Maximum value
		float max = r > g ? ( r > b ? r : b) : ( g > b ? g : b );
		// Minimum value
		float min = r < g ? ( r < b ? r : b) : ( g < b ? g : b );
		float delta = max - min;

		hsv[2] = max;

		if( max != 0 )
			hsv[1] = delta / max;
		else {
			hsv[0] = Float.NaN;
			hsv[1] = 0;
			return;
		}

		float h;
		if( r == max )
			h = ( g - b ) / delta;
		else if( g == max )
			h = 2 + ( b - r ) / delta;
		else
			h = 4 + ( r - g ) / delta;

		h *= d60_F32;
		if( h < 0 )
			h += PI2_F32;

		hsv[0] = h;
	}
167643
private function hue_to_rgb($v1, $v2, $vh)
    {
        $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
        if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh;
        if ($vh * 2 < 1) return $v2;
        if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
        return $v1;
    }
78471
def _hsla(h, s, l, a, **kwargs):
    
    res = colorsys.hls_to_rgb(float(h), float(l), float(s))
    return ColorValue([x * 255.0 for x in res] + [float(a)])
179914
function rgbToHsv(r, g, b) {

    r = bound01(r, 255);
    g = bound01(g, 255);
    b = bound01(b, 255);

    var max = mathMax(r, g, b), min = mathMin(r, g, b);
    var h, s, v = max;

    var d = max - min;
    s = max === 0 ? 0 : d / max;

    if(max == min) {
        h = 0; // achromatic
    }
    else {
        switch(max) {
            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
            case g: h = (b - r) / d + 2; break;
            case b: h = (r - g) / d + 4; break;
        }
        h /= 6;
    }
    return { h: h, s: s, v: v };
}
32215
private void HSVtoRGB(float hue, float sat, float bri) {

        int i;
        float f;
        float p;
        float q;
        float t;
        if (sat == 0) {
            m_red = bri;
            m_green = bri;
            m_blue = bri;
            return;
        }
        hue /= 60;
        i = (int)Math.floor(hue);
        f = hue - i;
        p = bri * (1 - sat);
        q = bri * (1 - (sat * f));
        t = bri * (1 - (sat * (1 - f)));
        switch (i) {
            case 0:
                m_red = bri;
                m_green = t;
                m_blue = p;
                break;
            case 1:
                m_red = q;
                m_green = bri;
                m_blue = p;
                break;
            case 2:
                m_red = p;
                m_green = bri;
                m_blue = t;
                break;
            case 3:
                m_red = p;
                m_green = q;
                m_blue = bri;
                break;
            case 4:
                m_red = t;
                m_green = p;
                m_blue = bri;
                break;
            default: // case 5:
                m_red = bri;
                m_green = p;
                m_blue = q;
                break;
        }
    }
615379
public boolean matches (float[] hsv, int[] fhsv)
    {
        // check to see that this color is sufficiently "close" to the
        // root color based on the supplied distance parameters
        if (distance(fhsv[0], _fhsv[0], Short.MAX_VALUE) > range[0] * Short.MAX_VALUE) {
            return false;
        }

        // saturation and value don't wrap around like hue
        if (Math.abs(_hsv[1] - hsv[1]) > range[1] ||
            Math.abs(_hsv[2] - hsv[2]) > range[2]) {
            return false;
        }

        return true;
    }
469964
def rgb_to_hsl_hsv(a, isHSV=True):
    
    R, G, B = a.T

    m = np.min(a, 1).T
    M = np.max(a, 1).T

    C = M - m #chroma
    Cmsk = C != 0

    # Hue
    H = np.zeros(R.shape, int)
    mask = (M == R) & Cmsk
    H[mask] = np.mod(60 * (G[mask] - B[mask]) / C[mask], 360)
    mask = (M == G) & Cmsk
    H[mask] = (60 * (B[mask] - R[mask]) / C[mask] + 120)
    mask = (M == B) & Cmsk
    H[mask] = (60 * (R[mask] - G[mask]) / C[mask] + 240)
    H *= 255
    H /= 360 # if you prefer, leave as 0-360, but don't convert to uint8


    # Saturation
    S = np.zeros(R.shape, int)

    if isHSV:
        # This code is for HSV:
        # Value
        V = M

        # Saturation
        S[Cmsk] = ((255 * C[Cmsk]) / V[Cmsk])
        # H, S, and V are now defined as integers 0-255
        return np.array((H.swapaxes(0, 1), S.swapaxes(0, 1), V.swapaxes(0, 1))).T
    else:
        # This code is for HSL:
        # Value
        L = 0.5 * (M + m)

        # Saturation
        S[Cmsk] = ((C[Cmsk]) / (1 - np.absolute(2 * L[Cmsk]/255.0 - 1)))
        # H, S, and L are now defined as integers 0-255
        return np.array((H.swapaxes(0, 1), S.swapaxes(0, 1), L.swapaxes(0, 1))).T
936028
private Color buildHSBColor(final HSBColor hsbColor) {
        Color color = null;
        if (hsbColor.opacity() >= 1.0) {
            color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness());
        } else {
            color = Color.hsb(hsbColor.hue(), hsbColor.saturation(), hsbColor.brightness(), hsbColor.opacity());
        }
        return color;
    }