ColorPicker
A widget that provides an interface for selecting or modifying a color.
ColorPicker.swift:21class ColorPicker
A widget that provides an interface for selecting or modifying a color. It can optionally provide functionalities like a color sampler (eyedropper), color modes, and presets.
This object emits the following signals:
Superclasses
class VBoxContainer
A container that arranges its child controls vertically.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
enum ColorModeType
enum PickerShapeType
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
Type members
Instance members
var canAddSwatches: Bool
If
true
, it’s possible to add presets under Swatches. Iffalse
, the button to add presets is disabled.var color: Color
The currently selected color.
var colorChanged: Signal1
Emitted when the color is changed.
var colorMode: ColorPicker.ColorModeType
The currently selected color mode. See
ColorModeType
.var colorModesVisible: Bool
If
true
, the color mode buttons are visible.var deferredMode: Bool
If
true
, the color will apply only after the user releases the mouse button, otherwise it will apply immediately even in mouse motion event (which can cause performance issues).var editAlpha: Bool
If
true
, shows an alpha channel slider (opacity).var hexVisible: Bool
If
true
, the hex color code input field is visible.var pickerShape: ColorPicker.PickerShapeType
The shape of the color space view. See
PickerShapeType
.var presetAdded: Signal2
Emitted when a preset is added.
var presetRemoved: Signal3
Emitted when a preset is removed.
var presetsVisible: Bool
If
true
, the Swatches and Recent Colors presets are visible.var samplerVisible: Bool
If
true
, the color sampler and color preview are visible.var slidersVisible: Bool
If
true
, the color sliders are visible.func addPreset(color: Color
) Adds the given color to a list of color presets. The presets are displayed in the color picker and the user will be able to select them.
func addRecentPreset(color: Color
) Adds the given color to a list of color recent presets so that it can be picked later. Recent presets are the colors that were picked recently, a new preset is automatically created and added to recent presets when you pick a new color.
func erasePreset(color: Color
) Removes the given color from the list of color presets of this color picker.
func eraseRecentPreset(color: Color
) Removes the given color from the list of color recent presets of this color picker.
func getPresets(
) -> PackedColorArray Returns the list of colors in the presets of the color picker.
func getRecentPresets(
) -> PackedColorArray Returns the list of colors in the recent presets of the color picker.