Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

khalilgharbaoui/coloregex

Open more actions menu

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

Contributors 2

  •  
  •  
Morty Proxy This is a proxified and sanitized view of the page, visit original site.