def html_to_rgb(html):
html = html.strip().lower()<EOL>if html[<NUM_LIT:0>]=='<STR_LIT:#>':<EOL><INDENT>html = html[<NUM_LIT:1>:]<EOL><DEDENT>elif html in NAMED_COLOR:<EOL><INDENT>html = NAMED_COLOR[html][<NUM_LIT:1>:]<EOL><DEDENT>if len(html)==<NUM_LIT:6>:<EOL><INDENT>rgb = html[:<NUM_LIT:2>], html[<NUM_LIT:2>:<NUM_LIT:4>], html[<NUM_LIT:4>:]<EOL><DEDENT>elif len(html)==<NUM_LIT:3>:<EOL><INDENT>rgb = ['<STR_LIT>' % (v,v) for v in html]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % html)<EOL><DEDENT>return tuple(((int(n, <NUM_LIT:16>) / <NUM_LIT>) for n in rgb))<EOL>
Convert the HTML color to (r, g, b).

    Parameters:
      :html:
        the HTML definition of the color (#RRGGBB or #RGB or a color name).

    Returns:
      The color as an (r, g, b) tuple in the range:
      r[0...1],
      g[0...1],
      b[0...1]

    Throws:
      :ValueError:
        If html is neither a known color name or a hexadecimal RGB
        representation.

    >>> '(%g, %g, %g)' % html_to_rgb('#ff8000')
    '(1, 0.501961, 0)'
    >>> '(%g, %g, %g)' % html_to_rgb('ff8000')
    '(1, 0.501961, 0)'
    >>> '(%g, %g, %g)' % html_to_rgb('#f60')
    '(1, 0.4, 0)'
    >>> '(%g, %g, %g)' % html_to_rgb('f60')
    '(1, 0.4, 0)'
    >>> '(%g, %g, %g)' % html_to_rgb('lemonchiffon')
    '(1, 0.980392, 0.803922)'