def html_color(color_name, opacity = nil)
      if color_name.to_s =~ HTML_COLOR_REGEXP
        opacity ||= $2 ? ($2.to_f * 255.0).round : 0xff
        base_color_name = $1.gsub(/[^a-z]+/i, "").downcase.to_sym
        return PREDEFINED_COLORS[base_color_name] | opacity if PREDEFINED_COLORS.key?(base_color_name)
      end
      raise ArgumentError, "Unknown color name #{color_name}!"
    end
def html_color(color_name, opacity = nil)
      if color_name.to_s =~ HTML_COLOR_REGEXP
        opacity ||= $2 ? ($2.to_f * 255.0).round : 0xff
        base_color_name = $1.gsub(/[^a-z]+/i, "").downcase.to_sym
        return PREDEFINED_COLORS[base_color_name] | opacity if PREDEFINED_COLORS.key?(base_color_name)
      end
      raise ArgumentError, "Unknown color name #{color_name}!"
    end
Gets a color value based on a HTML color name.

 The color name is flexible. E.g. <tt>'yellowgreen'</tt>, <tt>'Yellow
 green'</tt>, <tt>'YellowGreen'</tt>, <tt>'YELLOW_GREEN'</tt> and
 <tt>:yellow_green</tt> will all return the same color value.

 You can include a opacity level in the color name (e.g. <tt>'red @
 0.5'</tt>) or give an explicit opacity value as second argument. If no
 opacity value is given, the color will be fully opaque.

 @param [Symbol, String] color_name The color name. It may include an
   opacity specifier like <tt>@ 0.8</tt> to set the color's opacity.
 @param [Integer] opacity The opacity value for the color between 0 and
   255. Overrides any opacity value given in the color name.
 @return [Integer] The color value.
 @raise [ChunkyPNG::Exception] If the color name was not recognized.