ColorPicker
classin packageklyn.gui.windows
public class ColorPicker extends Container:
└ ColorPicker

Themed color-selection widget with RGB, HSV, HSL, color-wheel and spectrum modes.

The lower inspector keeps decimal and hexadecimal representations in sync, exposes a curated palette, and remembers colors explicitly committed by the user. color is a signal property suitable for one-way, two-way, or watched bindings.

import klyn.binding
import klyn.gui.windows

picker = ColorPicker(Color.fromHex("#3B82F6"))
Binding.watch(picker::color, lambda(value: Object): print(value))
Fields
Modifier and Type Member Description
public const HSL
HSL as String = "hsl"
Hue, saturation and lightness selection mode.
public const HSV
HSV as String = "hsv"
Hue, saturation and value selection mode.
public const RGB
RGB as String = "rgb"
RGB channel selection mode.
public const SPECTRUM
SPECTRUM as String = "spectrum"
Visual saturation/value square with a hue strip.
public const WHEEL
WHEEL as String = "wheel"
Hue wheel surrounding a saturation/value square.
Properties
Modifier and Type Member Description
public property mode
mode as String:
Active selection mode.
Inherited Properties
propertyInherited Properties from Container: autoRelayout, childCount, layout, padding
propertyInherited Properties from Widget: accentColor, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, width, window, x, y
Signals
Modifier and Type Member Description
public signal property color
color as Color:
Current selected color.
Inherited Events
eventInherited Events from Widget: focusGained, focusLost, keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public ColorPicker
ColorPicker(color as Color = null, mode as String = ColorPicker.RGB):
Creates a color picker.
Methods
Modifier and Type Member Description
public rememberCurrentColor
rememberCurrentColor() as Void:
Adds the current color to the recent-colors strip.
public reset
reset(color as Color) as Void:
Starts a new selection while preserving the recent-colors history.
Inherited Methods
methodInherited Methods from Container: add, applyLayout, attachWindow, children, clear, paint, paintOverlay, remove, setBounds, withLayout
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds
Inherited Operators
operatorInherited Operators from Container: operator[](index as Int) as Widget:, operator[](index as UInt) as Widget: