Unity color hexadecimal a hsv

/// <summary>
    /// 颜色十六进制转hsv
    /// </summary>
    /// <param name="colorValue">hex</param>
    /// <param name="hsvVec">0~1 h,s,v</param>
    public static void ColorHexToHsv(string colorValue, out Vector3 hsvVec)
    {
    
    
        Color rgbColor;

        //rgb 0~1
        ColorUtility.TryParseHtmlString(colorValue, out rgbColor);

        //rgb 0~1
        //hsv 0~1
        Color.RGBToHSV(rgbColor, out hsvVec.x, out hsvVec.y, out hsvVec.z);
    }

Supongo que te gusta

Origin blog.csdn.net/weixin_47819574/article/details/129420292
Recomendado
Clasificación