Project

coloregex

0.0
No release in over 3 years
Low commit activity in last 3 years
Coloregex saves you from dealing with regex for colors, it contains all 147 named colors including `transparant`. And deals with any kind of color code: `hex`, `rgb`, `rgba`, `hsl`, `hsla` properly!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.11
~> 5.2
~> 3.8
~> 0.10
~> 1.3, >= 1.3.13
 Project Readme

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