言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

EditorGUIUtility.HSVToRGB

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function HSVToRGB(H: float, S: float, V: float): Color;
public static Color HSVToRGB(float H, float S, float V);
public static def HSVToRGB(H as float, S as float, V as float) as Color

Parameters

h 色の色相 - 範囲は0~1
s 色の彩度
v 色の値

Returns

Color 関数に渡されたHSV値から計算してRGB色を返します。alpha値は1になります。

Description

カラースペースをHSVからRBGへ変換します

変換された値の範囲は0から1になります See Also: RGBToHSV.

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