def color(color_code = nil) # :nodoc:
      if color_code.respond_to?(:to_int) && color_code.respond_to?(:+)
        # the default color if arg is outside range,
        if color_code < 0 || 63 < color_code
          0x7FFF
        # or an index < 8 mapped into the correct range,
        elsif color_code < 8
          (color_code + 8).to_i
        # or an integer in the valid range
        else
          color_code.to_i
        end
      elsif color_code.respond_to?(:to_sym)
        color_code = color_code.downcase.to_sym if color_code.respond_to?(:to_str)
        COLORS[color_code] || 0x7FFF
      else
        0x7FFF
      end
    end
def color(color_code = nil) # :nodoc:
      if color_code.respond_to?(:to_int) && color_code.respond_to?(:+)
        # the default color if arg is outside range,
        if color_code < 0 || 63 < color_code
          0x7FFF
        # or an index < 8 mapped into the correct range,
        elsif color_code < 8
          (color_code + 8).to_i
        # or an integer in the valid range
        else
          color_code.to_i
        end
      elsif color_code.respond_to?(:to_sym)
        color_code = color_code.downcase.to_sym if color_code.respond_to?(:to_str)
        COLORS[color_code] || 0x7FFF
      else
        0x7FFF
      end
    end
:nodoc:


 get_color(colour)

 Used in conjunction with the set_xxx_color methods to convert a color
 string into a number. Color range is 0..63 but we will restrict it
 to 8..63 to comply with Gnumeric. Colors 0..7 are repeated in 8..15.