code: def mpltype_role(
      name, rawtext, text, lineno, inliner, options={}, content=[]
  ):
      mpltype = text
      type_to_link_target = {
          "color": "colors_def",
      }
      if mpltype not in type_to_link_target:
          raise ValueError(f"Unknown mpltype: {mpltype!r}")
  
      ref_nodes, messages = inliner.interpreted(
          mpltype,
          f"{mpltype} <{type_to_link_target[mpltype]}>",
          "ref",
          lineno,
      )
      node_list = [ref_nodes]
      return node_list, messages
  
file_path: matplotlib/doc/sphinxext/custom_roles.py
imports: from urllib.parse import urlsplit, urlunsplit
  from docutils import nodes
  from matplotlib import rcParamsDefault
label_desc: Use image node_id 4 for calling a global function with example usage: mpltype_role(name, rawtext, text, lineno, inliner, options, content) and returns: node_list,  messages