class_docstr: Render named entities as HTML.
class_docstr_tok: ["Render","named","entities","as","HTML","."]
docstr: Initialise entity renderer.
  
  options (dict): Visualiser-specific options (colors, ents)
docstr_tok: ["Initialise","entity","renderer",".","options","(","dict",")",":","Visualiser-specific","options","(","colors",",","ents",")"]
code: def __init__(self, options: Dict[str, Any] = {}) -> None:
      """Initialise entity renderer.
  
      options (dict): Visualiser-specific options (colors, ents)
      """
      colors = dict(DEFAULT_LABEL_COLORS)
      user_colors = registry.displacy_colors.get_all()
      for user_color in user_colors.values():
          if callable(user_color):
              # Since this comes from the function registry, we want to make
              # sure we support functions that *return* a dict of colors
              user_color = user_color()
          if not isinstance(user_color, dict):
              raise ValueError(Errors.E925.format(obj=type(user_color)))
          colors.update(user_color)
      colors.update(options.get("colors", {}))
      self.default_color = DEFAULT_ENTITY_COLOR
      self.colors = {
          label.upper(): color for label, color in colors.items()
      }
      self.ents = options.get("ents", None)
      if self.ents is not None:
          self.ents = [ent.upper() for ent in self.ents]
      self.direction = DEFAULT_DIR
      self.lang = DEFAULT_LANG
      template = options.get("template")
      if template:
          self.ent_template = template
      else:
          if self.direction == "rtl":
              self.ent_template = TPL_ENT_RTL
          else:
              self.ent_template = TPL_ENT
  
imports: import uuid
  from typing import Any, Dict, List, Optional, Tuple, Union
  from ..errors import Errors
  from ..util import escape_html, minify_html, registry
  from .templates import TPL_DEP_ARCS, TPL_DEP_SVG, TPL_DEP_WORDS, TPL_DEP_WORDS_LEMMA, TPL_ENT, TPL_ENT_RTL, TPL_ENTS, TPL_FIGURE, TPL_KB_LINK, TPL_PAGE, TPL_SPAN, TPL_SPAN_RTL, TPL_SPAN_SLICE, TPL_SPAN_SLICE_RTL, TPL_SPAN_START, TPL_SPAN_START_RTL, TPL_SPANS, TPL_TITLE
label_desc: Use image node_id 1 to create a new EntityRenderer object  with example: obj = EntityRenderer(options)