rgbColor | 変換するRGBカラー |
H | 色の色相が書き込まれる |
S | 色の彩度が書き込まれる |
V | 色の値が書き込まれる |
RGBからHSV色空間へ変換します
全ての値は0~1の範囲です。 See Also: HSVToRGB.
// Simple script that shows the color info on // RGB (Red Green Blue) values and // HSV (Hue Saturation Value) values. 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; } }