Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
holoviz
GitHub Repository: holoviz/panel
Path: blob/main/examples/reference/widgets/ColorPicker.ipynb
2011 views
Kernel: Unknown Kernel
import panel as pn pn.extension()

The ColorPicker widget allows selecting a color using the browser's color-picking widget support.

Discover more on using widgets to add interactivity to your applications in the how-to guides on interactivity. Alternatively, learn how to set up callbacks and (JS-)links between parameters or how to use them as part of declarative UIs with Param.

Parameters:

For details on other options for customizing the component see the layout and styling how-to guides.

Core
  • value (color): A hexadecimal RGB color value

Display
  • disabled (boolean): Whether the widget is editable

  • name (str): The title of the widget


When clicked the ColorPicker opens a browser-dependent color-picking widget:

colorpicker = pn.widgets.ColorPicker(name='Color Picker', value='#99ef78') colorpicker

ColorPicker.value returns a hexadecimal RGB value:

colorpicker.value

Controls

The ColorPicker widget exposes a number of options which can be changed from both Python and Javascript. Try out the effect of these parameters interactively:

pn.Row(colorpicker.controls(jslink=True), colorpicker)