class_docstr: Helper class to convert between different color representations used in the pyvista library.
  
  Many pyvista methods accept :data:`ColorLike` parameters. This helper class
  is used to convert such parameters to the necessary format, used by
  underlying (VTK) methods. Any color name (``str``), hex string (``str``)
  or RGB(A) sequence (``tuple``, ``list`` or ``numpy.ndarray`` of ``int``
  or ``float``) is considered a :data:`ColorLike` parameter and can be converted
  by this class.
  See :attr:`Color.name` for a list of supported color names.
  
  Parameters
  ----------
  color : ColorLike, optional
      Either a string, RGB sequence, RGBA sequence, or hex color string.
      RGB(A) sequences should either be provided as floats between 0 and 1
      or as ints between 0 and 255. Hex color strings can contain optional
      ``'#'`` or ``'0x'`` prefixes. If no opacity is provided, the
      ``default_opacity`` will be used. If ``color`` is ``None``, the
      ``default_color`` is used instead.
      The following examples all denote the color 'white':
  
      * ``'white'``
      * ``'w'``
      * ``[1.0, 1.0, 1.0]``
      * ``[255, 255, 255, 255]``
      * ``'#FFFFFF'``
  
  opacity : int | float | str, optional
      Opacity of the represented color. Overrides any opacity associated
      with the provided ``color``. Allowed opacities are floats between 0
      and 1, ints between 0 and 255 or hexadecimal strings of length 2
      (plus the length of the optional prefix).
      The following examples all denote a fully opaque color:
  
      * ``1.0``
      * ``255``
      * ``'#ff'``
  
  default_color : ColorLike, optional
      Default color to use when ``color`` is ``None``. If this value is
      ``None``, then defaults to the global theme color. Format is
      identical to ``color``.
  
  default_opacity : int | float | str, optional
      Default opacity of the represented color. Used when ``color``
      does not specify an opacity and ``opacity`` is ``None``. Format
      is identical to ``opacity``.
  
  Notes
  -----
  The internally used representation is an integer RGBA sequence (values
  between 0 and 255). This might however change in future releases.
  
  .. raw:: html
  
     <details><summary>Refer to the table below for a list of supported colors.</summary>
  
  .. include:: ../color_table/color_table.rst
  
  .. raw:: html
  
     </details>
  
  Examples
  --------
  Create a transparent green color using a color name, float RGBA sequence,
  integer RGBA sequence and RGBA hexadecimal string.
  
  >>> import pyvista as pv
  >>> pv.Color("green", opacity=0.5)
  Color(name='green', hex='#00800080', opacity=128)
  >>> pv.Color([0.0, 0.5, 0.0, 0.5])
  Color(name='green', hex='#00800080', opacity=128)
  >>> pv.Color([0, 128, 0, 128])
  Color(name='green', hex='#00800080', opacity=128)
  >>> pv.Color("#00800080")
  Color(name='green', hex='#00800080', opacity=128)
class_docstr_tok: ["Helper","class","to","convert","between","different","color","representations","used","in","the","pyvista","library",".","Many","pyvista","methods","accept",":","data",":","`","ColorLike","`","parameters",".","This","helper","class","is","used","to","convert","such","parameters","to","the","necessary","format",",","used","by","underlying","(","VTK",")","methods",".","Any","color","name","(","``","str","``",")",",","hex","string","(","``","str","``",")","or","RGB","(","A",")","sequence","(","``","tuple","``",",","``","list","``","or","``","numpy.ndarray","``","of","``","int","``","or","``","float","``",")","is","considered","a",":","data",":","`","ColorLike","`","parameter","and","can","be","converted","by","this","class",".","See",":","attr",":","`","Color.name","`","for","a","list","of","supported","color","names",".","Parameters","--","--","--","--","--","color",":","ColorLike",",","optional","Either","a","string",",","RGB","sequence",",","RGBA","sequence",",","or","hex","color","string",".","RGB","(","A",")","sequences","should","either","be","provided","as","floats","between","0","and","1","or","as","ints","between","0","and","255",".","Hex","color","strings","can","contain","optional","``","'","#","'","``","or","``","'0x","'","``","prefixes",".","If","no","opacity","is","provided",",","the","``","default_opacity","``","will","be","used",".","If","``","color","``","is","``","None","``",",","the","``","default_color","``","is","used","instead",".","The","following","examples","all","denote","the","color","'white","'",":","*","``","'white","'","``","*","``","'","w","'","``","*","``","[","1.0",",","1.0",",","1.0","]","``","*","``","[","255",",","255",",","255",",","255","]","``","*","``","'","#","FFFFFF","'","``","opacity",":","int","|","float","|","str",",","optional","Opacity","of","the","represented","color",".","Overrides","any","opacity","associated","with","the","provided","``","color","``",".","Allowed","opacities","are","floats","between","0","and","1",",","ints","between","0","and","255","or","hexadecimal","strings","of","length","2","(","plus","the","length","of","the","optional","prefix",")",".","The","following","examples","all","denote","a","fully","opaque","color",":","*","``","1.0","``","*","``","255","``","*","``","'","#","ff","'","``","default_color",":","ColorLike",",","optional","Default","color","to","use","when","``","color","``","is","``","None","``",".","If","this","value","is","``","None","``",",","then","defaults","to","the","global","theme","color",".","Format","is","identical","to","``","color","``",".","default_opacity",":","int","|","float","|","str",",","optional","Default","opacity","of","the","represented","color",".","Used","when","``","color","``","does","not","specify","an","opacity","and","``","opacity","``","is","``","None","``",".","Format","is","identical","to","``","opacity","``",".","Notes","--","--","-","The","internally","used","representation","is","an","integer","RGBA","sequence","(","values","between","0","and","255",")",".","This","might","however","change","in","future","releases",".","..","raw",":",":","html","<","details",">","<","summary",">","Refer","to","the","table","below","for","a","list","of","supported","colors.","<","\/summary",">","..","include",":",":","..","\/color_table\/color_table.rst","..","raw",":",":","html","<","\/details",">","Examples","--","--","--","--","Create","a","transparent","green","color","using","a","color","name",",","float","RGBA","sequence",",","integer","RGBA","sequence","and","RGBA","hexadecimal","string",".",">",">",">","import","pyvista","as","pv",">",">",">","pv.Color","(","``","green","''",",","opacity=0.5",")","Color","(","name='green","'",",","hex=","'","#","00800080","'",",","opacity=128",")",">",">",">","pv.Color","(","[","0.0",",","0.5",",","0.0",",","0.5","]",")","Color","(","name='green","'",",","hex=","'","#","00800080","'",",","opacity=128",")",">",">",">","pv.Color","(","[","0",",","128",",","0",",","128","]",")","Color","(","name='green","'",",","hex=","'","#","00800080","'",",","opacity=128",")",">",">",">","pv.Color","(","``","#","00800080","''",")","Color","(","name='green","'",",","hex=","'","#","00800080","'",",","opacity=128",")"]
docstr: Convert to dictionary for JSON serialization.
code: def to_dict(self):
      """Convert to dictionary for JSON serialization."""
      return {
          "r": self._red,
          "g": self._green,
          "b": self._blue,
          "a": self._opacity,
      }
  
imports: from __future__ import annotations
  import inspect
  from typing import Optional, Tuple, Union
  from cycler import Cycler, cycler
  from matplotlib.colors import ListedColormap
  import matplotlib.pyplot
  import numpy
  import pyvista
  from pyvista.core.utilities.misc import has_module
  from .None import _vtk
  from ._typing import ColorLike
label_desc: Use image node_id 19 for calling the Color obj's underlying member method code with example usage: obj.to_dict() and returns: dict