code: def _color_picker(
      self,
      label: str,
      value: Optional[str] = None,
      key: Optional[Key] = None,
      help: Optional[str] = None,
      on_change: Optional[WidgetCallback] = None,
      args: Optional[WidgetArgs] = None,
      kwargs: Optional[WidgetKwargs] = None,
      *,  # keyword-only arguments:
      disabled: bool = False,
      label_visibility: LabelVisibility = "visible",
      ctx: Optional[ScriptRunContext] = None,
  ) -> str:
      key = to_key(key)
      check_callback_rules(self.dg, on_change)
      check_session_state_rules(default_value=value, key=key)
      maybe_raise_label_warnings(label, label_visibility)
  
      id = compute_widget_id(
          "color_picker",
          user_key=key,
          label=label,
          value=str(value),
          key=key,
          help=help,
          form_id=current_form_id(self.dg),
          page=ctx.page_script_hash if ctx else None,
      )
  
      # set value default
      if value is None:
          value = "#000000"
  
      # make sure the value is a string
      if not isinstance(value, str):
          raise StreamlitAPIException(
              """
                  Color Picker Value has invalid type: %s. Expects a hex string
                  like '#00FFAA' or '#000'.
                  """
              % type(value).__name__
          )
  
      # validate the value and expects a hex string
      match = re.match(r"^#(?:[0-9a-fA-F]{3}){1,2}$", value)
  
      if not match:
          raise StreamlitAPIException(
              """
                  '%s' is not a valid hex code for colors. Valid ones are like
                  '#00FFAA' or '#000'.
                  """
              % value
          )
  
      color_picker_proto = ColorPickerProto()
      color_picker_proto.id = id
      color_picker_proto.label = label
      color_picker_proto.default = str(value)
      color_picker_proto.form_id = current_form_id(self.dg)
      color_picker_proto.disabled = disabled
      color_picker_proto.label_visibility.value = (
          get_label_visibility_proto_value(label_visibility)
      )
  
      if help is not None:
          color_picker_proto.help = dedent(help)
  
      serde = ColorPickerSerde(value)
  
      widget_state = register_widget(
          "color_picker",
          color_picker_proto,
          user_key=key,
          on_change_handler=on_change,
          args=args,
          kwargs=kwargs,
          deserializer=serde.deserialize,
          serializer=serde.serialize,
          ctx=ctx,
      )
  
      if widget_state.value_changed:
          color_picker_proto.value = widget_state.value
          color_picker_proto.set_value = True
  
      self.dg._enqueue("color_picker", color_picker_proto)
      return widget_state.value
  
imports: import re
  from dataclasses import dataclass
  from textwrap import dedent
  from typing import Optional, cast
  import streamlit
  from streamlit.elements.form import current_form_id
  from streamlit.elements.utils import check_callback_rules, check_session_state_rules, get_label_visibility_proto_value
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.ColorPicker_pb2 import ColorPicker
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
  from streamlit.runtime.state import WidgetArgs, WidgetCallback, WidgetKwargs, register_widget
  from streamlit.runtime.state.common import compute_widget_id
  from streamlit.type_util import Key, LabelVisibility, maybe_raise_label_warnings, to_key
label_desc: Use image node_id 2 for calling the ColorPickerMixin obj's underlying member method code with example usage: obj._color_picker(label, value, key, help, on_change, args, kwargs) and returns: widget_state