# ToString

> Returns a formatted string of this color.

## Definition

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

## ToString()

Returns a formatted string of this color.

```csharp
public override readonly string ToString()
```

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Examples

```csharp
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        Color color = Color.magenta;

        // Print "RGBA(1.000, 0.000, 1.000, 1.000)"
        print(color.ToString());

        color = new Color(Random.value, Random.value, Random.value, 1.0f);

        // Print for example "RGBA(0.36183, 0.49653, 0.04036, 1.00000)"
        // "F5" sets the format to 5 floating point digits  
        print(color.ToString("F5"));
    }
}
```

## ToString(string)

Returns a formatted string of this color.

```csharp
public readonly string ToString(string format)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A numeric format string.

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Examples

```csharp
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        Color color = Color.magenta;

        // Print "RGBA(1.000, 0.000, 1.000, 1.000)"
        print(color.ToString());

        color = new Color(Random.value, Random.value, Random.value, 1.0f);

        // Print for example "RGBA(0.36183, 0.49653, 0.04036, 1.00000)"
        // "F5" sets the format to 5 floating point digits  
        print(color.ToString("F5"));
    }
}
```

## ToString(string, IFormatProvider)

Returns a formatted string of this color.

```csharp
public readonly string ToString(string format, IFormatProvider formatProvider)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A numeric format string.**** (\[IFormatProvider]\(https\://learn.microsoft.com/dotnet/api/system.iformatprovider)): An object that specifies culture-specific formatting.

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### Examples

```csharp
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        Color color = Color.magenta;

        // Print "RGBA(1.000, 0.000, 1.000, 1.000)"
        print(color.ToString());

        color = new Color(Random.value, Random.value, Random.value, 1.0f);

        // Print for example "RGBA(0.36183, 0.49653, 0.04036, 1.00000)"
        // "F5" sets the format to 5 floating point digits  
        print(color.ToString("F5"));
    }
}
```
