coloregex 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -14
- data/lib/coloregex.rb +1 -2
- data/lib/coloregex/version.rb +1 -1
- metadata +5 -5
- data/lib/coloregex/railtie.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c73a6689805f1fa1f5af3da81a95ca2c542a3f87d2549ff99b30ca2f8495665f
|
4
|
+
data.tar.gz: 8c915617984523042a573572f772f036f5f16c50c413be77115113ee38647c10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2da0fbf46cfae241a0e7a29c446a8f7cd23abe81acf994b5e2a0cec3c867c6fcfbe26c5cc1f4029e3347dbfe6135463369f0d7be53d43d1a2f60d58813deb3
|
7
|
+
data.tar.gz: 6087e36a2ee1d099b7ff857849c592a902f0533f14cf3db756f7eef5c51f2f13f484bebc78baf2aec023ef2806278f6c6bcf86f930f13e56e33c83e3e06b6356
|
data/README.md
CHANGED
@@ -1,25 +1,36 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/khalilgharbaoui/coloregex.svg?branch=master)](https://travis-ci.org/khalilgharbaoui/coloregex) [![Gem Version](https://badge.fury.io/rb/coloregex.svg)](https://badge.fury.io/rb/coloregex)
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
[![Build Status](https://travis-ci.org/khalilgharbaoui/coloregex.svg?branch=master)](https://travis-ci.org/khalilgharbaoui/coloregex) [![Gem Version](https://badge.fury.io/rb/coloregex.svg)](https://badge.fury.io/rb/coloregex)
|
2
|
+
|
3
|
+
[![coloRegex](coloRegex.png)](coloRegex.png)
|
4
|
+
|
5
|
+
The coloRegex gem saves you from dealing with regex for colors, it contains all 148 named
|
6
|
+
colors including `transparent` and `currentColor`.
|
5
7
|
And deals with any kind of color code: `hex`, `rgb`, `rgba`, `hsl`, `hsla`.
|
6
8
|
|
7
9
|
## Usage
|
8
|
-
|
9
|
-
|
10
|
-
## Installation
|
11
|
-
Add this line to your application's Gemfile:
|
10
|
+
Nothing fancy here after installation you'll have a new constant available: `COLOREGEX`
|
12
11
|
|
12
|
+
#### Example usage:
|
13
13
|
```ruby
|
14
|
-
|
14
|
+
class Person < ActiveRecord::Base
|
15
|
+
validates_format_of :color, with: COLOREGEX, on: :create
|
16
|
+
end
|
15
17
|
```
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
Or:
|
19
|
+
```ruby
|
20
|
+
'#FF0000'.match?(COLOREGEX)
|
21
|
+
#=> true
|
22
|
+
'#FF000Q'.match?(COLOREGEX)
|
23
|
+
#=> false
|
20
24
|
```
|
21
25
|
|
22
|
-
|
26
|
+
## Installation
|
27
|
+
For bundler add it to your Gemfile:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
gem 'coloregex', '~> 0.1.2'
|
31
|
+
```
|
32
|
+
|
33
|
+
For manual do:
|
23
34
|
```bash
|
24
35
|
$ gem install coloregex
|
25
36
|
```
|
@@ -32,3 +43,6 @@ $ gem install coloregex
|
|
32
43
|
|
33
44
|
## License
|
34
45
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
46
|
+
|
47
|
+
## Credits
|
48
|
+
- Thanks to Adil Yakubi for creating the cool illustration you see above.
|
data/lib/coloregex.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'coloregex/railtie'
|
4
3
|
require 'coloregex/version'
|
5
4
|
|
6
|
-
COLOREGEX = /(#(?:[0-9a-
|
5
|
+
COLOREGEX = /(#(?:[0-9a-f]{2}){2,4}$|(#[0-9a-f]{3}$)|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\)$|black$|silver$|gray$|whitesmoke$|maroon$|red$|purple$|fuchsia$|green$|lime$|olivedrab$|yellow$|navy$|blue$|teal$|aquamarine$|orange$|aliceblue$|antiquewhite$|aqua$|azure$|beige$|bisque$|blanchedalmond$|blueviolet$|brown$|burlywood$|cadetblue$|chartreuse$|chocolate$|coral$|cornflowerblue$|cornsilk$|crimson$|currentcolor$|darkblue$|darkcyan$|darkgoldenrod$|darkgray$|darkgreen$|darkgrey$|darkkhaki$|darkmagenta$|darkolivegreen$|darkorange$|darkorchid$|darkred$|darksalmon$|darkseagreen$|darkslateblue$|darkslategray$|darkslategrey$|darkturquoise$|darkviolet$|deeppink$|deepskyblue$|dimgray$|dimgrey$|dodgerblue$|firebrick$|floralwhite$|forestgreen$|gainsboro$|ghostwhite$|goldenrod$|gold$|greenyellow$|grey$|honeydew$|hotpink$|indianred$|indigo$|ivory$|khaki$|lavenderblush$|lavender$|lawngreen$|lemonchiffon$|lightblue$|lightcoral$|lightcyan$|lightgoldenrodyellow$|lightgray$|lightgreen$|lightgrey$|lightpink$|lightsalmon$|lightseagreen$|lightskyblue$|lightslategray$|lightslategrey$|lightsteelblue$|lightyellow$|limegreen$|linen$|mediumaquamarine$|mediumblue$|mediumorchid$|mediumpurple$|mediumseagreen$|mediumslateblue$|mediumspringgreen$|mediumturquoise$|mediumvioletred$|midnightblue$|mintcream$|mistyrose$|moccasin$|navajowhite$|oldlace$|olive$|orangered$|orchid$|palegoldenrod$|palegreen$|paleturquoise$|palevioletred$|papayawhip$|peachpuff$|peru$|pink$|plum$|powderblue$|rosybrown$|royalblue$|saddlebrown$|salmon$|sandybrown$|seagreen$|seashell$|sienna$|skyblue$|slateblue$|slategray$|slategrey$|snow$|springgreen$|steelblue$|tan$|thistle$|tomato$|transparent$|turquoise$|violet$|wheat$|white$|yellowgreen$|rebeccapurple$)/i.freeze
|
data/lib/coloregex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coloregex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Khalil Gharbaoui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,7 +17,7 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.2'
|
20
|
-
type: :
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- README.md
|
115
115
|
- Rakefile
|
116
116
|
- lib/coloregex.rb
|
117
|
-
- lib/coloregex/railtie.rb
|
118
117
|
- lib/coloregex/version.rb
|
119
118
|
- lib/tasks/coloregex_tasks.rake
|
120
119
|
homepage: https://github.com/khalilgharbaoui/coloregex
|
@@ -137,7 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: '0'
|
139
138
|
requirements: []
|
140
|
-
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.7.7
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Deal with color regex the easy way!
|
data/lib/coloregex/railtie.rb
DELETED