ColorPicker

package
v0.0.0-...-fa94a0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

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.

Note: This control is the color picker widget itself. You can use a ColorPickerButton instead if you need a button that brings up a ColorPicker in a popup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsColorPicker() Instance
}

type ColorModeType

type ColorModeType int //gd:ColorPicker.ColorModeType
const (
	// Allows editing the color with Red/Green/Blue sliders in sRGB color space.
	ModeRgb ColorModeType = 0
	// Allows editing the color with Hue/Saturation/Value sliders.
	ModeHsv ColorModeType = 1
	ModeRaw ColorModeType = 2
	// Allows editing the color with Red/Green/Blue sliders in linear color space.
	ModeLinear ColorModeType = 2
	// Allows editing the color with Hue/Saturation/Lightness sliders.
	//
	// OKHSL is a new color space similar to HSL but that better match perception by leveraging the Oklab color space which is designed to be simple to use, while doing a good job at predicting perceived lightness, chroma and hue.
	//
	// [Okhsv and Okhsl color spaces]
	//
	// [Okhsv and Okhsl color spaces]: https://bottosson.github.io/posts/colorpicker/
	ModeOkhsl ColorModeType = 3
)

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsBoxContainer

func (self *Extension[T]) AsBoxContainer() BoxContainer.Instance

func (*Extension[T]) AsCanvasItem

func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance

func (*Extension[T]) AsColorPicker

func (self *Extension[T]) AsColorPicker() Instance

func (*Extension[T]) AsContainer

func (self *Extension[T]) AsContainer() Container.Instance

func (*Extension[T]) AsControl

func (self *Extension[T]) AsControl() Control.Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsVBoxContainer

func (self *Extension[T]) AsVBoxContainer() VBoxContainer.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.ColorPicker

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPreset

func (self Instance) AddPreset(color Color.RGBA)

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.

Note: The presets list is only for this color picker.

func (Instance) AddRecentPreset

func (self Instance) AddRecentPreset(color Color.RGBA)

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.

Note: The recent presets list is only for this color picker.

func (Instance) AsBoxContainer

func (self Instance) AsBoxContainer() BoxContainer.Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsColorPicker

func (self Instance) AsColorPicker() Instance

func (Instance) AsContainer

func (self Instance) AsContainer() Container.Instance

func (Instance) AsControl

func (self Instance) AsControl() Control.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsVBoxContainer

func (self Instance) AsVBoxContainer() VBoxContainer.Instance

func (Instance) CanAddSwatches

func (self Instance) CanAddSwatches() bool

func (Instance) Color

func (self Instance) Color() Color.RGBA

func (Instance) ColorMode

func (self Instance) ColorMode() ColorModeType

func (Instance) ColorModesVisible

func (self Instance) ColorModesVisible() bool

func (Instance) DeferredMode

func (self Instance) DeferredMode() bool

func (Instance) EditAlpha

func (self Instance) EditAlpha() bool

func (Instance) EditIntensity

func (self Instance) EditIntensity() bool

func (Instance) ErasePreset

func (self Instance) ErasePreset(color Color.RGBA)

Removes the given color from the list of color presets of this color picker.

func (Instance) EraseRecentPreset

func (self Instance) EraseRecentPreset(color Color.RGBA)

Removes the given color from the list of color recent presets of this color picker.

func (Instance) GetPresets

func (self Instance) GetPresets() []Color.RGBA

Returns the list of colors in the presets of the color picker.

func (Instance) GetRecentPresets

func (self Instance) GetRecentPresets() []Color.RGBA

Returns the list of colors in the recent presets of the color picker.

func (Instance) HexVisible

func (self Instance) HexVisible() bool

func (Instance) ID

func (self Instance) ID() ID

func (Instance) OnColorChanged

func (self Instance) OnColorChanged(cb func(color Color.RGBA), flags ...Signal.Flags)

func (Instance) OnPresetAdded

func (self Instance) OnPresetAdded(cb func(color Color.RGBA), flags ...Signal.Flags)

func (Instance) OnPresetRemoved

func (self Instance) OnPresetRemoved(cb func(color Color.RGBA), flags ...Signal.Flags)

func (Instance) PickerShape

func (self Instance) PickerShape() PickerShapeType

func (Instance) PresetsVisible

func (self Instance) PresetsVisible() bool

func (Instance) SamplerVisible

func (self Instance) SamplerVisible() bool

func (Instance) SetCanAddSwatches

func (self Instance) SetCanAddSwatches(value bool)

func (Instance) SetColor

func (self Instance) SetColor(value Color.RGBA)

func (Instance) SetColorMode

func (self Instance) SetColorMode(value ColorModeType)

func (Instance) SetColorModesVisible

func (self Instance) SetColorModesVisible(value bool)

func (Instance) SetDeferredMode

func (self Instance) SetDeferredMode(value bool)

func (Instance) SetEditAlpha

func (self Instance) SetEditAlpha(value bool)

func (Instance) SetEditIntensity

func (self Instance) SetEditIntensity(value bool)

func (Instance) SetHexVisible

func (self Instance) SetHexVisible(value bool)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPickerShape

func (self Instance) SetPickerShape(value PickerShapeType)

func (Instance) SetPresetsVisible

func (self Instance) SetPresetsVisible(value bool)

func (Instance) SetSamplerVisible

func (self Instance) SetSamplerVisible(value bool)

func (Instance) SetSlidersVisible

func (self Instance) SetSlidersVisible(value bool)

func (Instance) SlidersVisible

func (self Instance) SlidersVisible() bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type PickerShapeType

type PickerShapeType int //gd:ColorPicker.PickerShapeType
const (
	// HSV Color Model rectangle color space.
	ShapeHsvRectangle PickerShapeType = 0
	// HSV Color Model rectangle color space with a wheel.
	ShapeHsvWheel PickerShapeType = 1
	// HSV Color Model circle color space. Use Saturation as a radius.
	ShapeVhsCircle PickerShapeType = 2
	// HSL OK Color Model circle color space.
	ShapeOkhslCircle PickerShapeType = 3
	// The color space shape and the shape select button are hidden. Can't be selected from the shapes popup.
	ShapeNone PickerShapeType = 4
	// OKHSL Color Model rectangle with constant lightness.
	ShapeOkHsRectangle PickerShapeType = 5
	// OKHSL Color Model rectangle with constant saturation.
	ShapeOkHlRectangle PickerShapeType = 6
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL