ColorPicker#
Basic ColorPicker
Inherits: LayoutControl
Properties
-
color(ColorValue | None) –The currently selected color.
-
color_history(list[ColorValue] | None) –A list of colors to display as a history palette.
-
color_picker_width(Number | None) –Width of the color picker in virtual pixels.
-
display_thumb_color(bool) –Whether to display the thumb color in slider.
-
enable_alpha(bool) –Whether to enable alpha (opacity) slider.
-
hex_input_bar(bool) –Whether to show the hex input bar.
-
hsv_color(HsvColor | None) –The currently selected HSV color.
-
label_text_style(TextStyle | None) –Text style for labels.
-
label_types(list[ColorLabelType] | None) –Color label types to display.
-
palette_type(PaletteType | None) –Palette type for the picker area.
-
picker_area_border_radius(BorderRadiusValue | None) –Border radius for the picker area.
-
picker_area_height_percent(Number | None) –Height of the picker area as a percentage of the picker width.
Events
-
on_color_change(ControlEventHandler[ColorPicker] | None) –Called when the picker color is changed.
-
on_history_change(ControlEventHandler[ColorPicker] | None) –Called when the history palette is changed.
-
on_hsv_color_change(ControlEventHandler[ColorPicker] | None) –Called when the picker HSV color is changed.
Example#
Properties#
color
class-attribute
instance-attribute
#
color: ColorValue | None = None
The currently selected color.
color_history
class-attribute
instance-attribute
#
color_history: list[ColorValue] | None = None
A list of colors to display as a history palette.
To be notified when the palette changes, set on_history_change.
color_picker_width
class-attribute
instance-attribute
#
color_picker_width: Number | None = None
Width of the color picker in virtual pixels.
display_thumb_color
class-attribute
instance-attribute
#
display_thumb_color: bool = True
Whether to display the thumb color in slider.
enable_alpha
class-attribute
instance-attribute
#
enable_alpha: bool = True
Whether to enable alpha (opacity) slider.
hex_input_bar
class-attribute
instance-attribute
#
hex_input_bar: bool = True
Whether to show the hex input bar.
hsv_color
class-attribute
instance-attribute
#
The currently selected HSV color.
Provide an HsvColor instance with fields: alpha, hue, saturation,
value.
label_text_style
class-attribute
instance-attribute
#
label_text_style: TextStyle | None = None
Text style for labels.
label_types
class-attribute
instance-attribute
#
label_types: list[ColorLabelType] | None = None
Color label types to display.
palette_type
class-attribute
instance-attribute
#
Palette type for the picker area.
picker_area_border_radius
class-attribute
instance-attribute
#
picker_area_border_radius: BorderRadiusValue | None = None
Border radius for the picker area.
picker_area_height_percent
class-attribute
instance-attribute
#
picker_area_height_percent: Number | None = None
Height of the picker area as a percentage of the picker width.
Events#
on_color_change
class-attribute
instance-attribute
#
on_color_change: ControlEventHandler[ColorPicker] | None = (
None
)
Called when the picker color is changed.
The data property of the event handler argument contains
the color value as a hex string.
on_history_change
class-attribute
instance-attribute
#
on_history_change: (
ControlEventHandler[ColorPicker] | None
) = None
Called when the history palette is changed.
The data property of the event handler argument contains
the list of color values as hex strings.
on_hsv_color_change
class-attribute
instance-attribute
#
on_hsv_color_change: (
ControlEventHandler[ColorPicker] | None
) = None
Called when the picker HSV color is changed.
The data property of the event handler argument contains
the HSV values as a dict with keys: alpha, hue, saturation, value.
