# Equals

> Returns true if the given color is exactly equal to this color, i.e. if the red, green, blue, and alpha values are exactly the same.

## Definition

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

## Equals(Object)

Returns true if the given color is exactly equal to this color, i.e. if the red, green, blue, and alpha values are exactly the same.

```csharp
public override readonly bool Equals(object other)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): The other Color that is used for the equality check.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the given color is exactly equal to this color. |

### Remarks

Due to floating point inaccuracies, this might return false for colors which are essentially (but not exactly) equal. Use the == operator to test two Colors for approximate equality.

### Examples

```csharp
using UnityEngine;

public class ColorEqualsExample : MonoBehaviour
{
    Color a = new Color(1f, 0f, 0f, 1f);
    private Color b = Color.red;
    private Color c = new Color(0f, 1f, 0f, 1f);

    void Start()
    {
        Debug.Assert(a.Equals(b));
        Debug.Assert(!a.Equals(c));
    }
}
```

## Equals(Color)

Returns true if the given color is exactly equal to this color, i.e. if the red, green, blue, and alpha values are exactly the same.

```csharp
public readonly bool Equals(Color other)
```

### Parameters

**** (\[Color]\(/engine/6000.5/script-reference/unityengine/color)): The other Color that is used for the equality check.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the given color is exactly equal to this color. |

### Remarks

Due to floating point inaccuracies, this might return false for colors which are essentially (but not exactly) equal. Use the == operator to test two Colors for approximate equality.

### Examples

```csharp
using UnityEngine;

public class ColorEqualsExample : MonoBehaviour
{
    Color a = new Color(1f, 0f, 0f, 1f);
    private Color b = Color.red;
    private Color c = new Color(0f, 1f, 0f, 1f);

    void Start()
    {
        Debug.Assert(a.Equals(b));
        Debug.Assert(!a.Equals(c));
    }
}
```

## Equals(Color)

Returns true if the given color is exactly equal to this color, i.e. if the red, green, blue, and alpha values are exactly the same.

```csharp
public readonly bool Equals(in Color other)
```

### Parameters

**** (\[Color]\(/engine/6000.5/script-reference/unityengine/color)): The other Color that is used for the equality check.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the given color is exactly equal to this color. |

### Remarks

Due to floating point inaccuracies, this might return false for colors which are essentially (but not exactly) equal. Use the == operator to test two Colors for approximate equality.

### Examples

```csharp
using UnityEngine;

public class ColorEqualsExample : MonoBehaviour
{
    Color a = new Color(1f, 0f, 0f, 1f);
    private Color b = Color.red;
    private Color c = new Color(0f, 1f, 0f, 1f);

    void Start()
    {
        Debug.Assert(a.Equals(b));
        Debug.Assert(!a.Equals(c));
    }
}
```
