Class ColorPicker

Namespace
Forma
Assembly
Forma.dll

HSV color editor with deterministic pointer and keyboard adjustment.

[TemplatePart("PART_ColorField", typeof(Control), true)]
public sealed class ColorPicker : TemplatedControl, IAddChild<Control>, IAddChild, INotifyPropertyChanged, IDisposable
Inheritance
ColorPicker
Implements
Inherited Members

Constructors

ColorPicker()

public ColorPicker()

Fields

ColorFieldPartName

public const string ColorFieldPartName = "PART_ColorField"

Field Value

string

Properties

AccessibilityRole

public override AccessibilityRole AccessibilityRole { get; }

Property Value

AccessibilityRole

CanAddSwatches

public bool CanAddSwatches { get; set; }

Property Value

bool

Color

public Color Color { get; set; }

Property Value

Color

ColorHtml

public string ColorHtml { get; set; }

Property Value

string

ColorMode

public ColorPickerMode ColorMode { get; set; }

Property Value

ColorPickerMode

ColorizeSliders

public bool ColorizeSliders { get; set; }

Property Value

bool

DeferredMode

public bool DeferredMode { get; set; }

Property Value

bool

DisplayOldColor

public bool DisplayOldColor { get; set; }

Property Value

bool

EditAlpha

public bool EditAlpha { get; set; }

Property Value

bool

EditIntensity

public bool EditIntensity { get; set; }

Property Value

bool

HexVisible

public bool HexVisible { get; set; }

Property Value

bool

KeyboardAdjustmentStep

public float KeyboardAdjustmentStep { get; set; }

Property Value

float

ModesVisible

public bool ModesVisible { get; set; }

Property Value

bool

OldColor

Previous color shown by a ColorPickerButton popup, equivalent to Godot's old_color.

public Color OldColor { get; set; }

Property Value

Color

PickerShape

Interactive color surface layout, equivalent to Godot's picker_shape.

public ColorPickerShape PickerShape { get; set; }

Property Value

ColorPickerShape

Presets

public IReadOnlyList<Color> Presets { get; }

Property Value

IReadOnlyList<Color>

PresetsVisible

public bool PresetsVisible { get; set; }

Property Value

bool

RecentPresets

Recently committed colors, maintained independently from persistent presets.

public IReadOnlyList<Color> RecentPresets { get; }

Property Value

IReadOnlyList<Color>

SamplerVisible

public bool SamplerVisible { get; set; }

Property Value

bool

SlidersVisible

public bool SlidersVisible { get; set; }

Property Value

bool

Methods

AddPreset(Color)

Adds a preset, moving it to the back (most-recent position) if it already exists, matching Godot's ColorPicker::add_preset.

public void AddPreset(Color color)

Parameters

color Color

AddRecentPreset(Color)

Adds a unique recent swatch, retaining Godot's nine-color recent history limit.

public void AddRecentPreset(Color color)

Parameters

color Color

AreModesVisible()

public bool AreModesVisible()

Returns

bool

ArePresetsVisible()

public bool ArePresetsVisible()

Returns

bool

AreSlidersVisible()

public bool AreSlidersVisible()

Returns

bool

AreSwatchesEnabled()

public bool AreSwatchesEnabled()

Returns

bool

ClearPresets()

public void ClearPresets()

ClearRecentPresets()

public void ClearRecentPresets()

Commit()

public void Commit()

ErasePreset(Color)

public bool ErasePreset(Color color)

Parameters

color Color

Returns

bool

EraseRecentPreset(Color)

public bool EraseRecentPreset(Color color)

Parameters

color Color

Returns

bool

GetChannelLabel(int)

Returns the mode-specific label for a visible color channel.

public string GetChannelLabel(int channel)

Parameters

channel int

Returns

string

GetChannelMaximum(int)

Returns the upper bound used by Godot's selected ColorPicker channel mode.

public float GetChannelMaximum(int channel)

Parameters

channel int

Returns

float

GetChannelValue(int)

Reads a selected ColorPicker mode channel using Godot's displayed units.

public float GetChannelValue(int channel)

Parameters

channel int

Returns

float

GetColorMode()

public ColorPickerMode GetColorMode()

Returns

ColorPickerMode

GetHsv()

Gets hue, saturation and value in normalized 0..1 units.

public Vector3 GetHsv()

Returns

Vector3

GetOkHsl()

Gets the Godot ColorPicker OKHSL channel values in normalized 0..1 units.

public Vector3 GetOkHsl()

Returns

Vector3

GetOldColor()

public Color GetOldColor()

Returns

Color

GetPickColor()

public Color GetPickColor()

Returns

Color

GetPickerCursorNormalized()

public Vector2 GetPickerCursorNormalized()

Returns

Vector2

GetPickerShape()

public ColorPickerShape GetPickerShape()

Returns

ColorPickerShape

IsColorizingSliders()

public bool IsColorizingSliders()

Returns

bool

IsDeferredMode()

public bool IsDeferredMode()

Returns

bool

IsDisplayingOldColor()

public bool IsDisplayingOldColor()

Returns

bool

IsEditingAlpha()

public bool IsEditingAlpha()

Returns

bool

IsEditingIntensity()

public bool IsEditingIntensity()

Returns

bool

IsHexVisible()

public bool IsHexVisible()

Returns

bool

IsSamplerVisible()

public bool IsSamplerVisible()

Returns

bool

SelectPreset(int)

public void SelectPreset(int index)

Parameters

index int

SelectRecentPreset(int)

public void SelectRecentPreset(int index)

Parameters

index int

SetCanAddSwatches(bool)

public void SetCanAddSwatches(bool enabled)

Parameters

enabled bool

SetChannelValue(int, float)

Updates one selected ColorPicker mode channel using Godot's displayed units.

public void SetChannelValue(int channel, float value)

Parameters

channel int
value float

SetColorMode(ColorPickerMode)

public void SetColorMode(ColorPickerMode mode)

Parameters

mode ColorPickerMode

SetColorizeSliders(bool)

public void SetColorizeSliders(bool enabled)

Parameters

enabled bool

SetDeferredMode(bool)

public void SetDeferredMode(bool enabled)

Parameters

enabled bool

SetDisplayOldColor(bool)

public void SetDisplayOldColor(bool enabled)

Parameters

enabled bool

SetEditAlpha(bool)

public void SetEditAlpha(bool show)

Parameters

show bool

SetEditIntensity(bool)

public void SetEditIntensity(bool show)

Parameters

show bool

SetHexVisible(bool)

public void SetHexVisible(bool visible)

Parameters

visible bool

SetHsv(float, float, float, float?)

public void SetHsv(float hue, float saturation, float value, float? alpha = null)

Parameters

hue float
saturation float
value float
alpha float?

SetModesVisible(bool)

public void SetModesVisible(bool visible)

Parameters

visible bool

SetOkHsl(float, float, float, float?)

Sets the color from Godot's perceptually uniform OKHSL representation.

public void SetOkHsl(float hue, float saturation, float lightness, float? alpha = null)

Parameters

hue float
saturation float
lightness float
alpha float?

SetOldColor(Color)

public void SetOldColor(Color color)

Parameters

color Color

SetPickColor(Color)

public void SetPickColor(Color color)

Parameters

color Color

SetPickerCursorNormalized(Vector2)

public void SetPickerCursorNormalized(Vector2 cursor)

Parameters

cursor Vector2

SetPickerShape(ColorPickerShape)

public void SetPickerShape(ColorPickerShape shape)

Parameters

shape ColorPickerShape

SetPresets(IEnumerable<Color>)

public void SetPresets(IEnumerable<Color> colors)

Parameters

colors IEnumerable<Color>

SetPresetsVisible(bool)

public void SetPresetsVisible(bool visible)

Parameters

visible bool

SetSamplerVisible(bool)

public void SetSamplerVisible(bool visible)

Parameters

visible bool

SetSlidersVisible(bool)

public void SetSlidersVisible(bool visible)

Parameters

visible bool

Events

ColorChanged

public event Action<ColorPicker, Color> ColorChanged

Event Type

Action<ColorPicker, Color>

PresetSelected

public event Action<ColorPicker, Color> PresetSelected

Event Type

Action<ColorPicker, Color>

RecentPresetSelected

public event Action<ColorPicker, Color> RecentPresetSelected

Event Type

Action<ColorPicker, Color>