ColorPicker#

Download this notebook from GitHub (right-click to download).


import panel as pn
import panel_material_ui as pmui

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 customization guides.

Core#

  • disabled (boolean): Whether the widget is editable

  • value (color): A hexadecimal RGB color value

Display#

  • label (str): The title of the widget

Styling#

  • sx (dict): Component level styling API.

  • theme_config (dict): Theming API.

Aliases#

For compatibility with Panel certain parameters are allowed as aliases:

  • button_style: Alias for variant

  • button_type: Alias for color

  • name: Alias for label


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

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

colorpicker

ColorPicker.value returns a hexadecimal RGB value:

colorpicker.value
#99ef78

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)

Download this notebook from GitHub (right-click to download).