# HSVToRGB

> Creates an RGB colour from HSV input.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.3/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## HSVToRGB(float, float, float)

Creates an RGB colour from HSV input.

```csharp
public static Color HSVToRGB(float H, float S, float V)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Hue \[0..1].**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Saturation \[0..1].**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Brightness value \[0..1].

### Returns

| Type                                                          | Description                                   |
| ------------------------------------------------------------- | --------------------------------------------- |
| [Color](/engine/6000.3/script-reference/unityengine/color.md) | An opaque colour with HSV matching the input. |

### Remarks

Creates an RGB color from the hue, saturation and value of the input.

### Examples

```csharp
//Create three Sliders ( <b>Create</b>><b>UI</b>><b>Slider</b>)
//These are for manipulating the hue, saturation and value levels of the Color.

//Attach this script to a GameObject. Make sure it has a Renderer component.
//Click on the GameObject and attach each of the Sliders and Texts to the fields in the Inspector.

using UnityEngine;
using UnityEngine.UI;

public class ColorHSVtoRGBExample : MonoBehaviour
{
    float m_Hue;
    float m_Saturation;
    float m_Value;
    //These are the Sliders that control the values. Remember to attach them in the Inspector window.
    public Slider m_SliderHue, m_SliderSaturation, m_SliderValue;

    //Make sure your GameObject has a Renderer component in the Inspector window
    Renderer m_Renderer;

    void Start()
    {
        //Fetch the Renderer component from the GameObject with this script attached
        m_Renderer = GetComponent<Renderer>();

        //Set the maximum and minimum values for the Sliders
        m_SliderHue.maxValue = 1;
        m_SliderSaturation.maxValue = 1;
        m_SliderValue.maxValue = 1;

        m_SliderHue.minValue = 0;
        m_SliderSaturation.minValue = 0;
        m_SliderValue.minValue = 0;
    }

    void Update()
    {
        //These are the Sliders that determine the amount of the hue, saturation and value in the Color
        m_Hue = m_SliderHue.value;
        m_Saturation = m_SliderSaturation.value;
        m_Value = m_SliderValue.value;

        //Create an RGB color from the HSV values from the Sliders
        //Change the Color of your GameObject to the new Color
        m_Renderer.material.color = Color.HSVToRGB(m_Hue, m_Saturation, m_Value);
    }
}
```

## HSVToRGB(float, float, float, bool)

Creates an RGB colour from HSV input.

```csharp
public static Color HSVToRGB(float H, float S, float V, bool hdr)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Hue \[0..1].**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Saturation \[0..1].**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Brightness value \[0..1].**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Output HDR colours. If true, the returned colour will not be clamped to \[0..1].

### Returns

| Type                                                          | Description                                   |
| ------------------------------------------------------------- | --------------------------------------------- |
| [Color](/engine/6000.3/script-reference/unityengine/color.md) | An opaque colour with HSV matching the input. |

### Remarks

Creates an RGB color from the hue, saturation and value of the input.

### Examples

```csharp
//Create three Sliders ( <b>Create</b>><b>UI</b>><b>Slider</b>)
//These are for manipulating the hue, saturation and value levels of the Color.

//Attach this script to a GameObject. Make sure it has a Renderer component.
//Click on the GameObject and attach each of the Sliders and Texts to the fields in the Inspector.

using UnityEngine;
using UnityEngine.UI;

public class ColorHSVtoRGBExample : MonoBehaviour
{
    float m_Hue;
    float m_Saturation;
    float m_Value;
    //These are the Sliders that control the values. Remember to attach them in the Inspector window.
    public Slider m_SliderHue, m_SliderSaturation, m_SliderValue;

    //Make sure your GameObject has a Renderer component in the Inspector window
    Renderer m_Renderer;

    void Start()
    {
        //Fetch the Renderer component from the GameObject with this script attached
        m_Renderer = GetComponent<Renderer>();

        //Set the maximum and minimum values for the Sliders
        m_SliderHue.maxValue = 1;
        m_SliderSaturation.maxValue = 1;
        m_SliderValue.maxValue = 1;

        m_SliderHue.minValue = 0;
        m_SliderSaturation.minValue = 0;
        m_SliderValue.minValue = 0;
    }

    void Update()
    {
        //These are the Sliders that determine the amount of the hue, saturation and value in the Color
        m_Hue = m_SliderHue.value;
        m_Saturation = m_SliderSaturation.value;
        m_Value = m_SliderValue.value;

        //Create an RGB color from the HSV values from the Sliders
        //Change the Color of your GameObject to the new Color
        m_Renderer.material.color = Color.HSVToRGB(m_Hue, m_Saturation, m_Value);
    }
}
```
