# File lib/selenium/webdriver/support/color.rb, line 16
        def self.from_string(str)
          case str
          when RGB_PATTERN
            new $1, $2, $3
          when RGB_PCT_PATTERN
            new(*[$1, $2, $3].map { |e| Float(e) / 100 * 255 })
          when RGBA_PATTERN
            new $1, $2, $3, $4
          when RGBA_PCT_PATTERN
            new(*[$1, $2, $3].map { |e| Float(e) / 100 * 255 } << $4)
          when HEX_PATTERN
            new(*[$1, $2, $3].map { |e| e.to_i(16) })
          when HEX3_PATTERN
            new(*[$1, $2, $3].map { |e| (e * 2).to_i(16) })
          when HSL_PATTERN, HSLA_PATTERN
            from_hsl($1, $2, $3, $4)
          else
            raise ArgumentError, "could not convert #{str.inspect} into color"
          end
        end