color_namer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/lib/color_namer.rb +62 -0
- data/lib/color_namer/color_names.rb +1646 -0
- data/spec/color_namer_spec.rb +37 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +105 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "ColorNamer" do
|
4
|
+
|
5
|
+
it "should correctly name color from HTML hash" do
|
6
|
+
color_name = ColorNamer.name_from_html_hash('FF3300')
|
7
|
+
color_name[1].should == 'Scarlet'
|
8
|
+
color_name[2].should == 'Red'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should correctly name color from RGB string" do
|
12
|
+
color_name = ColorNamer.name_from_rgb('205, 94, 94')
|
13
|
+
color_name[1].should == 'Indian Red'
|
14
|
+
color_name[2].should == 'Red'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should correctly name color from RGB array" do
|
18
|
+
color_name = ColorNamer.name_from_rgb(205, 94, 94)
|
19
|
+
color_name[1].should == 'Indian Red'
|
20
|
+
color_name[2].should == 'Red'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should correctly name color from any Color object" do
|
24
|
+
color = Color::CMYK.new(30, 0, 80, 30)
|
25
|
+
color_name = ColorNamer.name(color)
|
26
|
+
color_name[1].should == 'Lima'
|
27
|
+
color_name[2].should == 'Green'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should raise ArgumentError when called with invalid arguments" do
|
31
|
+
expect{ ColorNamer.name_from_rgb('w2342345') }.to raise_error(ArgumentError)
|
32
|
+
expect{ ColorNamer.name_from_rgb('255.255.255') }.to raise_error(ArgumentError)
|
33
|
+
expect{ ColorNamer.name_from_rgb('123,123') }.to raise_error(ArgumentError)
|
34
|
+
expect{ ColorNamer.name_from_rgb(123,123) }.to raise_error(ArgumentError)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: color_namer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- retro
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-01 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: color
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 4
|
31
|
+
- 1
|
32
|
+
version: 1.4.1
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 2
|
46
|
+
- 9
|
47
|
+
version: 1.2.9
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
description: ColorNamer is a gem that allows you to name color from RGB value or from HTML hash. It will find the closest color and return a HTML hash, name and shade of that color.
|
51
|
+
email: konjevic@gmail.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files:
|
57
|
+
- LICENSE
|
58
|
+
- README.md
|
59
|
+
files:
|
60
|
+
- .document
|
61
|
+
- .gitignore
|
62
|
+
- LICENSE
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- VERSION
|
66
|
+
- lib/color_namer.rb
|
67
|
+
- lib/color_namer/color_names.rb
|
68
|
+
- spec/color_namer_spec.rb
|
69
|
+
- spec/spec.opts
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
has_rdoc: true
|
72
|
+
homepage: http://github.com/retro/color-namer
|
73
|
+
licenses: []
|
74
|
+
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- --charset=UTF-8
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.3.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: ColorNamer can name your color from RGB value or HTML hash
|
103
|
+
test_files:
|
104
|
+
- spec/color_namer_spec.rb
|
105
|
+
- spec/spec_helper.rb
|