ColorPaletteAttribute

ColorPalette is used on any Color property, and allows for choosing colors from different definerable palettes.

Use this to allow the user to choose from a set of predefined color options.

namespace Sirenix.OdinInspector
{
[AttributeUsageAttribute((AttributeTargets)384, AllowMultiple = False, Inherited = True)]
public sealed class ColorPaletteAttribute : Attribute
}

Requirements

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector
Version: 1.0.5.0

Constructors

Definition Description
ColorPaletteAttribute() Adds a color palette options to a Color property.
ColorPaletteAttribute(string) Adds color options to a Color property from a specific palette.

Properties

Return Type Definition Description
string PaletteName Gets the name of the palette.
bool ShowAlpha Indicates if the color palette should show alpha values or not.

Example

The following example shows how ColorPalette is applied to a property. The user can freely choose between all available ColorPalettes.

public class ColorPaletteExamples : MonoBehaviour
{
    [ColorPalette]
    public Color ColorOptions;

    [ColorPalette("Underwater")]
    public Color UnderwaterColor;

    [ColorPalette("Fall"), HideLabel]
    public Color WideColorPalette;

    [ColorPalette("My Palette")]
    public Color MyColor;

    [ColorPalette("Clovers")]
    public Color[] ColorArray;
}