Skip to content

adcombi/coloregex

 
 

Build Status Gem Version

coloRegex

The coloRegex gem saves you from dealing with regex for colors, it contains all 148 named colors including transparent and currentColor.
And deals with any kind of color code: hex, rgb, rgba, hsl, hsla.

Usage

Nothing fancy here after installation you'll have a new constant available: COLOREGEX

Example usage:

class Person < ActiveRecord::Base
  validates_format_of :color, with: COLOREGEX, on: :create
end

Or:

'#FF0000'.match?(COLOREGEX)
#=> true
'#FF000Q'.match?(COLOREGEX)
#=> false

Installation

For bundler add it to your Gemfile:

gem 'coloregex', '~> 0.1.2'

For manual do:

$ gem install coloregex

##Todo:

  • ?

Contributing

  • Your more than welcome to contribute; open up a pull request and i'll have a look.

License

The gem is available as open source under the terms of the MIT License.

Credits

  • Thanks to Adil Yakubi for creating the cool illustration you see above.
  • Thanks to all the commentators & contributors to this gist

About

No description, website, or topics provided.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE.txt
MIT
MIT-LICENSE

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 49.0%
  • Ruby 38.8%
  • HTML 10.6%
  • JavaScript 1.6%