ruby_colors 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module RubyColors
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1 @@
1
+ ["000000","000033","000066","000099","0000CC","0000FF","003300","003333","003366","003399","0033CC","0033FF","006600","006633","006666","006699","0066CC","0066FF","009900","009933","009966","009999","0099CC","0099FF","00CC00","00CC33","00CC66","00CC99","00CCCC","00CCFF","00FF00","00FF33","00FF66","00FF99","00FFCC","00FFFF","330000","330033","330066","330099","3300CC","3300FF","333300","333333","333366","333399","3333CC","3333FF","336600","336633","336666","336699","3366CC","3366FF","339900","339933","339966","339999","3399CC","3399FF","33CC00","33CC33","33CC66","33CC99","33CCCC","33CCFF","33FF00","33FF33","33FF66","33FF99","33FFCC","33FFFF","660000","660033","660066","660099","6600CC","6600FF","663300","663333","663366","663399","6633CC","6633FF","666600","666633","666666","666699","6666CC","6666FF","669900","669933","669966","669999","6699CC","6699FF","66CC00","66CC33","66CC66","66CC99","66CCCC","66CCFF","66FF00","66FF33","66FF66","66FF99","66FFCC","66FFFF","990000","990033","990066","990099","9900CC","9900FF","993300","993333","993366","993399","9933CC","9933FF","996600","996633","996666","996699","9966CC","9966FF","999900","999933","999966","999999","9999CC","9999FF","99CC00","99CC33","99CC66","99CC99","99CCCC","99CCFF","99FF00","99FF33","99FF66","99FF99","99FFCC","99FFFF","CC0000","CC0033","CC0066","CC0099","CC00CC","CC00FF","CC3300","CC3333","CC3366","CC3399","CC33CC","CC33FF","CC6600","CC6633","CC6666","CC6699","CC66CC","CC66FF","CC9900","CC9933","CC9966","CC9999","CC99CC","CC99FF","CCCC00","CCCC33","CCCC66","CCCC99","CCCCCC","CCCCFF","CCFF00","CCFF33","CCFF66","CCFF99","CCFFCC","CCFFFF","FF0000","FF0033","FF0066","FF0099","FF00CC","FF00FF","FF3300","FF3333","FF3366","FF3399","FF33CC","FF33FF","FF6600","FF6633","FF6666","FF6699","FF66CC","FF66FF","FF9900","FF9933","FF9966","FF9999","FF99CC","FF99FF","FFCC00","FFCC33","FFCC66","FFCC99","FFCCCC","FFCCFF","FFFF00","FFFF33","FFFF66","FFFF99","FFFFCC","FFFFFF"]
@@ -0,0 +1,75 @@
1
+ # Ruby Colors
2
+ ![Ruby Version](badges/ruby.svg)
3
+ [![License](badges/license.svg)](https://creativecommons.org/licenses/by/4.0/)
4
+
5
+ A simple Ruby library for conversion between color `names`, `HEX`, and `RGB`.
6
+
7
+
8
+ ## Installation
9
+ Add this line to your application's Gemfile:
10
+ ```ruby
11
+ gem 'ruby_colors'
12
+ ```
13
+ And then execute:
14
+ ```bash
15
+ bundle
16
+ ```
17
+ Or install it yourself as:
18
+ ```bash
19
+ gem install ruby_colors
20
+ ```
21
+
22
+
23
+ ## Usage
24
+ ```ruby
25
+ require 'ruby_colors'
26
+
27
+ color = ::RubyColors.by_hex('FF0000')
28
+ color = ::RubyColors.by_hex('#FF0000')
29
+
30
+ color = ::RubyColors.by_rgb( [255, 0, 0] )
31
+ color = ::RubyColors.by_rgb( 255, 0, 0 )
32
+
33
+ color = ::RubyColors.by_name('red')
34
+ color = ::RubyColors.by_name('Red')
35
+ color = ::RubyColors.by_name('RED')
36
+
37
+ color.hex # => 'FF0000'
38
+ color.short_hex # => 'FF0'
39
+ color.rgb # => [0, 0, 0]
40
+ color.names # => ['Red']
41
+ color.web_safe # => true
42
+ ```
43
+
44
+
45
+ ## Helper methods
46
+ * `hex_to_rgb`
47
+ ```ruby
48
+ ::RubyColors.hex_to_rgb('#000000') # => [0, 0, 0]
49
+ ::RubyColors.hex_to_rgb('#000') # => [0, 0, 0]
50
+ ::RubyColors.hex_to_rgb('000') # => [0, 0, 0]
51
+ ```
52
+ * `rgb_to_hex`
53
+ ```ruby
54
+ ::RubyColors.rgb_to_hex( [0, 0, 0] ) # => 00000
55
+ ::RubyColors.rgb_to_hex(0, 0, 0) # => 00000
56
+ ```
57
+ * `color_names`
58
+ ```ruby
59
+ ::RubyColors.color_names
60
+ # => {
61
+ # 'FF0000' => ['Red'],
62
+ # 'B3446C' => [ 'Raspberry Rose', 'Irresistible'],
63
+ # ...
64
+ # }
65
+ ```
66
+ * `web_safe_colors`
67
+ ```ruby
68
+ ::RubyColors.web_safe_colors
69
+ # => ['000000', '000033', '000066', ... ]
70
+ ```
71
+
72
+
73
+ ## Sources
74
+ * [ColorHexa.com](https://www.colorhexa.com)
75
+ * [Wikipedia - List of Colors](https://en.wikipedia.org/wiki/List_of_colors_(compact))
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+ require 'ruby_colors/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'ruby_colors'
6
+ s.version = RubyColors::VERSION.dup
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = 'EdCordata'
9
+ s.description = "A simple Ruby library for conversion between color 'names', 'HEX', and 'RGB'"
10
+ s.summary = "A simple Ruby library for conversion between color 'names', 'HEX', and 'RGB'"
11
+ s.licenses = ['CC BY 4.0']
12
+ s.files = Dir['lib/**/*.*'] + %w[ruby_colors.gemspec readme.md Gemfile Gemfile.lock]
13
+ s.homepage = 'https://github.com/EdCordata-Ruby-Gems/ruby_colors'
14
+ s.metadata = {
15
+ 'documentation_uri' => 'https://github.com/EdCordata-Ruby-Gems/ruby_colors/blob/master/readme.md',
16
+ 'source_code_uri' => 'https://github.com/EdCordata-Ruby-Gems/ruby_colors',
17
+ 'bug_tracker_uri' => 'https://github.com/EdCordata-Ruby-Gems/ruby_colors/issues',
18
+ 'wiki_uri' => 'https://github.com/EdCordata-Ruby-Gems/ruby_colors/blob/master/readme.md',
19
+ }
20
+ s.require_paths = ['lib']
21
+ s.required_ruby_version = '>= 1.9.3'
22
+ s.add_dependency('json', '>= 0.4.0')
23
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_colors
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - EdCordata
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.0
27
+ description: A simple Ruby library for conversion between color 'names', 'HEX', and
28
+ 'RGB'
29
+ email:
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Gemfile
35
+ - Gemfile.lock
36
+ - lib/ruby_colors.rb
37
+ - lib/ruby_colors/color.rb
38
+ - lib/ruby_colors/color_names.json
39
+ - lib/ruby_colors/version.rb
40
+ - lib/ruby_colors/web_safe_colors.json
41
+ - readme.md
42
+ - ruby_colors.gemspec
43
+ homepage: https://github.com/EdCordata-Ruby-Gems/ruby_colors
44
+ licenses:
45
+ - CC BY 4.0
46
+ metadata:
47
+ documentation_uri: https://github.com/EdCordata-Ruby-Gems/ruby_colors/blob/master/readme.md
48
+ source_code_uri: https://github.com/EdCordata-Ruby-Gems/ruby_colors
49
+ bug_tracker_uri: https://github.com/EdCordata-Ruby-Gems/ruby_colors/issues
50
+ wiki_uri: https://github.com/EdCordata-Ruby-Gems/ruby_colors/blob/master/readme.md
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.9.3
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.1.2
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: A simple Ruby library for conversion between color 'names', 'HEX', and 'RGB'
70
+ test_files: []