Version 2.1.0.0

ColorExtensions class

Namespace: Sirenix.Utilities
Assembly: Sirenix.Utilities
public static class ColorExtensions
Extension methods for the UnityEngine.Color type.
Inheritance
  • System.Object
  • ColorExtensions

Methods

Lerp(Color[], Single)
Lerps between multiple colors.
public static Color Lerp(this Color[] colors, float t)
Parameters
UnityEngine.Color[] colors

The colors.

System.Single t

The t.

Returns
UnityEngine.Color

MoveTowards(Color, Color, Single)
Moves the towards implementation for Color.
public static Color MoveTowards(this Color from, Color to, float maxDelta)
Parameters
UnityEngine.Color from

From color.

UnityEngine.Color to

To color.

System.Single maxDelta

The maximum delta.

Returns
UnityEngine.Color

NormalizeRGB(Color)
Normalizes the RGB values of the color ignoring the alpha value.
public static Color NormalizeRGB(this Color color)
Parameters
UnityEngine.Color color

The color.

Returns
UnityEngine.Color

Pow(Color, Single)
Pows the color with the specified factor.
public static Color Pow(this Color color, float factor)
Parameters
UnityEngine.Color color

The color.

System.Single factor

The factor.

Returns
UnityEngine.Color

ToCSharpColor(Color)
Converts a color to a string formatted to c#
public static string ToCSharpColor(this Color color)
Parameters
UnityEngine.Color color

The color.

Returns
System.String

new Color(r, g, b, a)

TryParseString(String, out Color)
Tries to parse a string to a Color. The following formats are supported: "new Color(0.4, 0, 0, 1)", "#FFEEBBFF", "#FFEECC", "FFEEBBFF", "FFEECC"
public static bool TryParseString(string colorStr, out Color color)
Parameters
System.String colorStr

The color string.

UnityEngine.Color color

The color.

Returns
System.Boolean

Returns true if the parse was a success.

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.