class_docstr: Represent a CSS named color, provided as RGB values.
  
  Instances of this class also record the name of the created color, which
  is used to populate the Bokeh enum for named colors.
class_docstr_tok: ["Represent","a","CSS","named","color",",","provided","as","RGB","values",".","Instances","of","this","class","also","record","the","name","of","the","created","color",",","which","is","used","to","populate","the","Bokeh","enum","for","named","colors","."]
docstr: Create an RGB color from a string.
  
  Args:
      color (str) :
          String containing color. This may be a named color such as
          "blue" or a hex RGB(A) string of one of the following formats:
          '#rrggbb', '#rrggbbaa', '#rgb' or '#rgba'.
  
  Returns:
      :class:`~bokeh.colors.RGB`
docstr_tok: ["Create","an","RGB","color","from","a","string",".","Args",":","color","(","str",")",":","String","containing","color",".","This","may","be","a","named","color","such","as","``","blue","''","or","a","hex","RGB","(","A",")","string","of","one","of","the","following","formats",":","'","#","rrggbb","'",",","'","#","rrggbbaa","'",",","'","#","rgb","'","or","'","#","rgba","'",".","Returns",":",":","class",":","`","~bokeh.colors.RGB","`"]
code: def from_string(cls, color: str) -> RGB:
      """Create an RGB color from a string.
  
      Args:
          color (str) :
              String containing color. This may be a named color such as
              "blue" or a hex RGB(A) string of one of the following formats:
              '#rrggbb', '#rrggbbaa', '#rgb' or '#rgba'.
  
      Returns:
          :class:`~bokeh.colors.RGB`
  
      """
  
      try:
          # Is it a hex string?
          return RGB.from_hex_string(color)
      except ValueError:
          # Is it a named color?
          rgb = cls.find(color)
  
          if rgb is None:
              raise ValueError(
                  f"Color '{color}' must be either a named color or an RGB(A) hex string"
              )
  
          return rgb
  
file_path: bokeh/src/bokeh/colors/util.py
imports: from __future__ import annotations
  import logging
  from typing import ClassVar, Iterator
  from .color import RGB
label_desc: Use image node_id 3 for calling the NamedColor obj's underlying member method code with example usage: obj.from_string(cls, color) and returns: RGB, rgb