EditorGUIUtility.HSVToRGB 转换颜色HSV到RGB


static function RGBToHSV (rgbColor : Color, out H : float, out S : float, out V : float) : void

Parameters参数

  • H
    the hue of the color - in the range 0 to 1. // 颜色的色调,范围在0-1
  • S
    the saturation of the color. // 颜色的饱和度
  • V
    the value of the color. // 颜色的亮度值

Returns

Convert a set of HSV values to an RGB Color.

转换HSV值到RGB颜色。

All values are in the range 0 - 1.

所有值的范围在0-1之间。

参见:RGBToHSV

// Simple script that shows the color info on// RGB (Red Green Blue) values and// HSV (Hue Saturation Value) values.//显示RGB和HSV颜色信息class RGBHSVInfo extends Editor{@MenuItem("Examples/Color Info")static function CheckColor() {var h : float = 0;var s : float = 0;var v : float = 0;var objColor : Color = Color.white;var obj = Selection.activeGameObject.renderer;if(!obj.renderer.material) {Debug.LogError("Selected Object doesnt have a material.");return;}objColor = obj.renderer.sharedMaterial.color;EditorGUIUtility.RGBToHSV(objColor,h,s,v);objColor = EditorGUIUtility.HSVToRGB(h,s,v);Debug.Log("RGB: " + objColor.r + "," + objColor.g + "," + objColor.b);Debug.Log("HSV: " + h + "," + s + "," + v);}@MenuItem("Examples/Color Info", true)static function ValidateCheckColor() {return Selection.activeGameObject != null;}}


,