color_swatch_collection 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 47fd39c5b293136ac4da3fc621eca1ebfdca90e6aafb402c76d859ebab8d5593
4
+ data.tar.gz: 47a7438fad3f2970764e0162f614a391dfd17ce9cab9af24563908341225c97d
5
+ SHA512:
6
+ metadata.gz: e87b9c29c88c133f8bb63edc11358325f78f335cacb36c82b8b4b33524e9cf376ce8c8323468d2b165058a92f5e520309696139e2fe3515ed3c7f70d9fb70a6c
7
+ data.tar.gz: 41a012cc9bd1a4cb0ad78e80e72368bbc38b28acd31f9dbc72037cbb0b99b3bca344e94bec22476149258818b6d0a091481ed5c5ff0a60fe94f6f3d27896d61e
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # ColorSwatchCollection
2
+
3
+ > Find a colour swatch from various collections.
4
+
5
+ ColorSwatchCollection is a ruby gem package for use in ruby or other projects that provides colour swatches with their name and hex code from various collections. You can find colour swatches by providing either the name or hex code you want to search against. You can also query collection colour lists directly.
6
+
7
+ ## Lists
8
+
9
+ The colour collections:
10
+
11
+ - [roygbiv](lib/color_namer_rails/roygbiv.rb)
12
+ - [basic](lib/color_namer_rails/basic.rb)
13
+ - [html](lib/color_namer_rails/html.rb) - the HTML color names.
14
+ - [x11](lib/color_namer_rails/x11.rb) - The list that preceded the HTML color names
15
+ - [pantone](lib/color_namer_rails/pantone.rb)
16
+ - [ntc](lib/color_namer_rails/ntc.rb), an [astounding collection](http://chir.ag/projects/ntc/) of over 1500 named colors.
17
+
18
+ ## Installation
19
+
20
+ Install the gem and add to the application's Gemfile by executing:
21
+
22
+ ```bash
23
+ bundle add color_swatch_collection
24
+ ```
25
+
26
+ If bundler is not being used to manage dependencies, install the gem by executing:
27
+
28
+ ```bash
29
+ gem install color_swatch_collection
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```ruby
35
+ ColorSwatchCollection.list_collections
36
+ => ['basic', 'html', 'ntc', 'pantone', 'roygbiv', 'x11']
37
+ ```
38
+
39
+ ```ruby
40
+ ColorSwatchCollection.get_from_hex('#FDBCB4')
41
+ => { name: 'melon', hex: '#FDBCB4', collection: 'pantone' }
42
+ ```
43
+
44
+ ```ruby
45
+ ColorSwatchCollection.get_from_name('navajo white')
46
+ => { name: 'navajowhite', hex: '#FFDEAD', collection: 'html' }
47
+ ```
48
+
49
+ ```ruby
50
+ ColorSwatchCollection.get_colours
51
+ => [
52
+ => { collection: 'basic', hex: '#000000', name: 'black' },
53
+ => { collection: 'basic', hex: '#0000FF', name: 'blue' },
54
+ => .
55
+ => .
56
+ => .
57
+ => ]
58
+ ```
59
+
60
+ ### pick
61
+
62
+ This parameter allows you to filter names from the dedicated lists for faster computation.
63
+ It can be used for `get_from_hex`, `get_from_name`, or `get_colours`.
64
+
65
+ ```ruby
66
+ ColorSwatchCollection.get_from_hex('#00FF00', pick: ['html', 'pantone'])
67
+ ColorSwatchCollection.get_from_name('blue', pick: ['x11'])
68
+ ColorSwatchCollection.get_colours(pick: ['basic'])
69
+ ```
70
+
71
+ ### omit
72
+
73
+ The opposite of `options.pick`.
74
+ It can be used for `get_from_hex`, `get_from_name`, or `get_colours`.
75
+
76
+ ```ruby
77
+ ColorSwatchCollection.get_from_hex('#00FF00', omit: ['html', 'pantone'])
78
+ ColorSwatchCollection.get_from_name('blue', omit: ['ntc'])
79
+ ColorSwatchCollection.get_colours(omit: ['ntc', 'basic'])
80
+ ```
81
+
82
+ ## Development
83
+
84
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
85
+
86
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
87
+
88
+ ## Contributing
89
+
90
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/louiswdavis/color_swatch_collection>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/louiswdavis/color_swatch_collection/blob/master/CODE_OF_CONDUCT.md).
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
95
+
96
+ ## Code of Conduct
97
+
98
+ Everyone interacting in the ColorSwatchCollection project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/louiswdavis/color_swatch_collection/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ColorSwatchCollection
4
+ class Basic
5
+ def self.colours
6
+ [
7
+ { name: 'black', hex: '#000000' },
8
+ { name: 'blue', hex: '#0000FF' },
9
+ { name: 'cyan', hex: '#00FFFF' },
10
+ { name: 'green', hex: '#008000' },
11
+ { name: 'teal', hex: '#008080' },
12
+ { name: 'turquoise', hex: '#40E0D0' },
13
+ { name: 'indigo', hex: '#4B0082' },
14
+ { name: 'gray', hex: '#808080' },
15
+ { name: 'purple', hex: '#800080' },
16
+ { name: 'brown', hex: '#A52A2A' },
17
+ { name: 'tan', hex: '#D2B48C' },
18
+ { name: 'violet', hex: '#EE82EE' },
19
+ { name: 'beige', hex: '#F5F5DC' },
20
+ { name: 'fuchsia', hex: '#FF00FF' },
21
+ { name: 'gold', hex: '#FFD700' },
22
+ { name: 'magenta', hex: '#FF00FF' },
23
+ { name: 'orange', hex: '#FFA500' },
24
+ { name: 'pink', hex: '#FFC0CB' },
25
+ { name: 'red', hex: '#FF0000' },
26
+ { name: 'white', hex: '#FFFFFF' },
27
+ { name: 'yellow', hex: '#FFFF00' }
28
+ ]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ColorSwatchCollection
4
+ class Html
5
+ def self.colours
6
+ [
7
+ { name: 'aqua', hex: '#00FFFF' },
8
+ { name: 'aliceblue', hex: '#F0F8FF' },
9
+ { name: 'antiquewhite', hex: '#FAEBD7' },
10
+ { name: 'black', hex: '#000000' },
11
+ { name: 'blue', hex: '#0000FF' },
12
+ { name: 'cyan', hex: '#00FFFF' },
13
+ { name: 'darkblue', hex: '#00008B' },
14
+ { name: 'darkcyan', hex: '#008B8B' },
15
+ { name: 'darkgreen', hex: '#006400' },
16
+ { name: 'darkturquoise', hex: '#00CED1' },
17
+ { name: 'deepskyblue', hex: '#00BFFF' },
18
+ { name: 'green', hex: '#008000' },
19
+ { name: 'lime', hex: '#00FF00' },
20
+ { name: 'mediumblue', hex: '#0000CD' },
21
+ { name: 'mediumspringgreen', hex: '#00FA9A' },
22
+ { name: 'navy', hex: '#000080' },
23
+ { name: 'springgreen', hex: '#00FF7F' },
24
+ { name: 'teal', hex: '#008080' },
25
+ { name: 'midnightblue', hex: '#191970' },
26
+ { name: 'dodgerblue', hex: '#1E90FF' },
27
+ { name: 'lightseagreen', hex: '#20B2AA' },
28
+ { name: 'forestgreen', hex: '#228B22' },
29
+ { name: 'seagreen', hex: '#2E8B57' },
30
+ { name: 'darkslategray', hex: '#2F4F4F' },
31
+ { name: 'darkslategrey', hex: '#2F4F4F' },
32
+ { name: 'limegreen', hex: '#32CD32' },
33
+ { name: 'mediumseagreen', hex: '#3CB371' },
34
+ { name: 'turquoise', hex: '#40E0D0' },
35
+ { name: 'royalblue', hex: '#4169E1' },
36
+ { name: 'steelblue', hex: '#4682B4' },
37
+ { name: 'darkslateblue', hex: '#483D8B' },
38
+ { name: 'mediumturquoise', hex: '#48D1CC' },
39
+ { name: 'indigo', hex: '#4B0082' },
40
+ { name: 'darkolivegreen', hex: '#556B2F' },
41
+ { name: 'cadetblue', hex: '#5F9EA0' },
42
+ { name: 'cornflowerblue', hex: '#6495ED' },
43
+ { name: 'mediumaquamarine', hex: '#66CDAA' },
44
+ { name: 'dimgray', hex: '#696969' },
45
+ { name: 'dimgrey', hex: '#696969' },
46
+ { name: 'slateblue', hex: '#6A5ACD' },
47
+ { name: 'olivedrab', hex: '#6B8E23' },
48
+ { name: 'slategray', hex: '#708090' },
49
+ { name: 'slategrey', hex: '#708090' },
50
+ { name: 'lightslategray', hex: '#778899' },
51
+ { name: 'lightslategrey', hex: '#778899' },
52
+ { name: 'mediumslateblue', hex: '#7B68EE' },
53
+ { name: 'lawngreen', hex: '#7CFC00' },
54
+ { name: 'aquamarine', hex: '#7FFFD4' },
55
+ { name: 'chartreuse', hex: '#7FFF00' },
56
+ { name: 'gray', hex: '#808080' },
57
+ { name: 'grey', hex: '#808080' },
58
+ { name: 'maroon', hex: '#800000' },
59
+ { name: 'olive', hex: '#808000' },
60
+ { name: 'purple', hex: '#800080' },
61
+ { name: 'lightskyblue', hex: '#87CEFA' },
62
+ { name: 'skyblue', hex: '#87CEEB' },
63
+ { name: 'blueviolet', hex: '#8A2BE2' },
64
+ { name: 'darkmagenta', hex: '#8B008B' },
65
+ { name: 'darkred', hex: '#8B0000' },
66
+ { name: 'saddlebrown', hex: '#8B4513' },
67
+ { name: 'darkseagreen', hex: '#8FBC8F' },
68
+ { name: 'lightgreen', hex: '#90EE90' },
69
+ { name: 'mediumpurple', hex: '#9370DB' },
70
+ { name: 'darkviolet', hex: '#9400D3' },
71
+ { name: 'palegreen', hex: '#98FB98' },
72
+ { name: 'darkorchid', hex: '#9932CC' },
73
+ { name: 'yellowgreen', hex: '#9ACD32' },
74
+ { name: 'sienna', hex: '#A0522D' },
75
+ { name: 'brown', hex: '#A52A2A' },
76
+ { name: 'darkgray', hex: '#A9A9A9' },
77
+ { name: 'darkgrey', hex: '#A9A9A9' },
78
+ { name: 'greenyellow', hex: '#ADFF2F' },
79
+ { name: 'lightblue', hex: '#ADD8E6' },
80
+ { name: 'paleturquoise', hex: '#AFEEEE' },
81
+ { name: 'lightsteelblue', hex: '#B0C4DE' },
82
+ { name: 'powderblue', hex: '#B0E0E6' },
83
+ { name: 'firebrick', hex: '#B22222' },
84
+ { name: 'darkgoldenrod', hex: '#B8860B' },
85
+ { name: 'mediumorchid', hex: '#BA55D3' },
86
+ { name: 'rosybrown', hex: '#BC8F8F' },
87
+ { name: 'darkkhaki', hex: '#BDB76B' },
88
+ { name: 'silver', hex: '#C0C0C0' },
89
+ { name: 'mediumvioletred', hex: '#C71585' },
90
+ { name: 'indianred', hex: '#CD5C5C' },
91
+ { name: 'peru', hex: '#CD853F' },
92
+ { name: 'chocolate', hex: '#D2691E' },
93
+ { name: 'tan', hex: '#D2B48C' },
94
+ { name: 'lightgray', hex: '#D3D3D3' },
95
+ { name: 'lightgrey', hex: '#D3D3D3' },
96
+ { name: 'thistle', hex: '#D8BFD8' },
97
+ { name: 'goldenrod', hex: '#DAA520' },
98
+ { name: 'orchid', hex: '#DA70D6' },
99
+ { name: 'palevioletred', hex: '#DB7093' },
100
+ { name: 'crimson', hex: '#DC143C' },
101
+ { name: 'gainsboro', hex: '#DCDCDC' },
102
+ { name: 'plum', hex: '#DDA0DD' },
103
+ { name: 'burlywood', hex: '#DEB887' },
104
+ { name: 'lightcyan', hex: '#E0FFFF' },
105
+ { name: 'lavender', hex: '#E6E6FA' },
106
+ { name: 'darksalmon', hex: '#E9967A' },
107
+ { name: 'palegoldenrod', hex: '#EEE8AA' },
108
+ { name: 'violet', hex: '#EE82EE' },
109
+ { name: 'azure', hex: '#F0FFFF' },
110
+ { name: 'honeydew', hex: '#F0FFF0' },
111
+ { name: 'khaki', hex: '#F0E68C' },
112
+ { name: 'lightcoral', hex: '#F08080' },
113
+ { name: 'sandybrown', hex: '#F4A460' },
114
+ { name: 'beige', hex: '#F5F5DC' },
115
+ { name: 'mintcream', hex: '#F5FFFA' },
116
+ { name: 'wheat', hex: '#F5DEB3' },
117
+ { name: 'whitesmoke', hex: '#F5F5F5' },
118
+ { name: 'ghostwhite', hex: '#F8F8FF' },
119
+ { name: 'lightgoldenrodyellow', hex: '#FAFAD2' },
120
+ { name: 'linen', hex: '#FAF0E6' },
121
+ { name: 'salmon', hex: '#FA8072' },
122
+ { name: 'oldlace', hex: '#FDF5E6' },
123
+ { name: 'bisque', hex: '#FFE4C4' },
124
+ { name: 'blanchedalmond', hex: '#FFEBCD' },
125
+ { name: 'coral', hex: '#FF7F50' },
126
+ { name: 'cornsilk', hex: '#FFF8DC' },
127
+ { name: 'darkorange', hex: '#FF8C00' },
128
+ { name: 'deeppink', hex: '#FF1493' },
129
+ { name: 'floralwhite', hex: '#FFFAF0' },
130
+ { name: 'fuchsia', hex: '#FF00FF' },
131
+ { name: 'gold', hex: '#FFD700' },
132
+ { name: 'hotpink', hex: '#FF69B4' },
133
+ { name: 'ivory', hex: '#FFFFF0' },
134
+ { name: 'lavenderblush', hex: '#FFF0F5' },
135
+ { name: 'lemonchiffon', hex: '#FFFACD' },
136
+ { name: 'lightpink', hex: '#FFB6C1' },
137
+ { name: 'lightsalmon', hex: '#FFA07A' },
138
+ { name: 'lightyellow', hex: '#FFFFE0' },
139
+ { name: 'magenta', hex: '#FF00FF' },
140
+ { name: 'mistyrose', hex: '#FFE4E1' },
141
+ { name: 'moccasin', hex: '#FFE4B5' },
142
+ { name: 'navajowhite', hex: '#FFDEAD' },
143
+ { name: 'orange', hex: '#FFA500' },
144
+ { name: 'orangered', hex: '#FF4500' },
145
+ { name: 'papayawhip', hex: '#FFEFD5' },
146
+ { name: 'peachpuff', hex: '#FFDAB9' },
147
+ { name: 'pink', hex: '#FFC0CB' },
148
+ { name: 'red', hex: '#FF0000' },
149
+ { name: 'seashell', hex: '#FFF5EE' },
150
+ { name: 'snow', hex: '#FFFAFA' },
151
+ { name: 'tomato', hex: '#FF6347' },
152
+ { name: 'white', hex: '#FFFFFF' },
153
+ { name: 'yellow', hex: '#FFFF00' }
154
+ ]
155
+ end
156
+ end
157
+ end