color 0.1.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Color
4
+ # Colour management with Ruby
5
+ # http://rubyforge.org/projects/color
6
+ # Version 1.4.0
7
+ #
8
+ # Licensed under a MIT-style licence. See Licence.txt in the main
9
+ # distribution for full licensing information.
10
+ #
11
+ # Copyright (c) 2005 - 2007 Austin Ziegler and Matt Lyon
12
+ #
13
+ # $Id: test_all.rb 55 2007-02-03 23:29:34Z austin $
14
+ #++
15
+
16
+ $LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") if __FILE__ == $0
17
+ require 'test/unit'
18
+ require 'color'
19
+
20
+ module TestColor
21
+ class TestYIQ < Test::Unit::TestCase
22
+ def setup
23
+ @yiq = Color::YIQ.from_fraction(0.1, 0.2, 0.3)
24
+ end
25
+
26
+ def test_brightness
27
+ assert_in_delta(0.1, @yiq.brightness, Color::COLOR_TOLERANCE)
28
+ end
29
+
30
+ def test_i
31
+ assert_in_delta(0.2, @yiq.i, Color::COLOR_TOLERANCE)
32
+ assert_in_delta(0.2, @yiq.i, Color::COLOR_TOLERANCE)
33
+ assert_nothing_raised { @yiq.i = 0.5 }
34
+ assert_in_delta(0.5, @yiq.i, Color::COLOR_TOLERANCE)
35
+ assert_nothing_raised { @yiq.i = 5 }
36
+ assert_in_delta(1.0, @yiq.i, Color::COLOR_TOLERANCE)
37
+ assert_nothing_raised { @yiq.i = -5 }
38
+ assert_in_delta(0.0, @yiq.i, Color::COLOR_TOLERANCE)
39
+ end
40
+
41
+ def test_q
42
+ assert_in_delta(0.3, @yiq.q, Color::COLOR_TOLERANCE)
43
+ assert_in_delta(0.3, @yiq.q, Color::COLOR_TOLERANCE)
44
+ assert_nothing_raised { @yiq.q = 0.5 }
45
+ assert_in_delta(0.5, @yiq.q, Color::COLOR_TOLERANCE)
46
+ assert_nothing_raised { @yiq.q = 5 }
47
+ assert_in_delta(1.0, @yiq.q, Color::COLOR_TOLERANCE)
48
+ assert_nothing_raised { @yiq.q = -5 }
49
+ assert_in_delta(0.0, @yiq.q, Color::COLOR_TOLERANCE)
50
+ end
51
+
52
+ def test_to_grayscale
53
+ assert_equal(Color::GrayScale.new(0.1), @yiq.to_grayscale)
54
+ end
55
+
56
+ def test_to_yiq
57
+ assert_equal(@yiq, @yiq.to_yiq)
58
+ end
59
+
60
+ def test_y
61
+ assert_in_delta(0.1, @yiq.y, Color::COLOR_TOLERANCE)
62
+ assert_in_delta(0.1, @yiq.y, Color::COLOR_TOLERANCE)
63
+ assert_nothing_raised { @yiq.y = 0.5 }
64
+ assert_in_delta(0.5, @yiq.y, Color::COLOR_TOLERANCE)
65
+ assert_nothing_raised { @yiq.y = 5 }
66
+ assert_in_delta(1.0, @yiq.y, Color::COLOR_TOLERANCE)
67
+ assert_nothing_raised { @yiq.y = -5 }
68
+ assert_in_delta(0.0, @yiq.y, Color::COLOR_TOLERANCE)
69
+ end
70
+
71
+ def test_inspect
72
+ assert_equal("YIQ [10.00%, 20.00%, 30.00%]", @yiq.inspect)
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,21 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: color
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2006-08-05 00:00:00 -07:00
8
- summary: A Simply Library for Color Manipulation
6
+ version: 1.4.0
7
+ date: 2007-11-29 00:00:00 -05:00
8
+ summary: Colour management with Ruby
9
9
  require_paths:
10
10
  - lib
11
- email: matt@postsomnia.com
12
- homepage: ""
11
+ email:
12
+ - austin@rubyforge.org
13
+ - matt@postsomnia.com
14
+ homepage: http://color.rubyforge.org/
13
15
  rubyforge_project: color
14
- description: Manipulate Colors Programatically
15
- autorequire: color
16
+ description: The capabilities of the Color library are limited to pure mathematical manipulation of the colours based on colour theory without reference to colour profiles (such as sRGB or Adobe RGB). For most purposes, when working with the RGB and HSL colours, this won't matter. However, some colour models (like CIE L*a*b*) are not supported because Color does not yet support colour profiles, giving no meaningful way to convert colours in absolute colour spaces (like L*a*b*, XYZ) to non-absolute colour spaces (like RGB).
17
+ autorequire:
16
18
  default_executable:
17
19
  bindir: bin
18
- has_rdoc: false
20
+ has_rdoc: true
19
21
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
22
  requirements:
21
23
  - - ">"
@@ -25,26 +27,96 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
27
  platform: ruby
26
28
  signing_key:
27
29
  cert_chain:
30
+ - |
31
+ -----BEGIN CERTIFICATE-----
32
+ MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZhdXN0
33
+ aW4xGTAXBgoJkiaJk/IsZAEZFglydWJ5Zm9yZ2UxEzARBgoJkiaJk/IsZAEZFgNv
34
+ cmcwHhcNMDcxMTMwMDE0OTAwWhcNMDgxMTI5MDE0OTAwWjBBMQ8wDQYDVQQDDAZh
35
+ dXN0aW4xGTAXBgoJkiaJk/IsZAEZFglydWJ5Zm9yZ2UxEzARBgoJkiaJk/IsZAEZ
36
+ FgNvcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDOSg1riVV22ord
37
+ q0t4YVx57GDPMqdjlnQ5M7D9iBnnW0c8pifegbb0dm+mC9hJSuPtcJS53+YPTy9F
38
+ wlZbjI2cN+P0QLUUTOlZus2sHq7Pr9jz2nJf8hCT7t5Vlopv1N/xlKtXqpcyEkhJ
39
+ JHTrxe1avGwuq8DIAIN01moQJ+hJlgrnR2eRJRazTGiXKBLGAFXDl/Agn78MHx6w
40
+ pzZ2APydo6Nuk7Ktq1MvCHzLzCACbOlYawFk3/9dbsmHhVjsi6YW+CpEJ2BnTy8X
41
+ JBXlyNTk1JxDmcs3RzNr+9AmDQh3u4LcmJnWxtLJo9e7UBxH/bwVORJyf8dAOmOm
42
+ HO6bFTLvAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
43
+ BBT9e1+pFfcV1LxVxILANqLtZzI/XTANBgkqhkiG9w0BAQUFAAOCAQEAhg42pvrL
44
+ uVlqAaHqV88KqgnW2ymCWm0ePohicFTcyiS5Yj5cN3OXLsPV2x12zqvLCFsfpA4u
45
+ D/85rngKFHITSW0h9e/CIT/pwQA6Uuqkbr0ypkoU6mlNIDS10PlK7aXXFTCP9X3f
46
+ IndAajiNRgKwb67nj+zpQwHa6dmooyRQIRRijrMKTgY6ebaCCrm7J3BLLTJAyxOW
47
+ +1nD0cuTkBEKIuSVK06E19Ml+xWt2bdtS9Wz/8jHivJ0SvUpbmhKVzh1rBslwm65
48
+ JpQgg3SsV23vF4qkCa2dt1FL+FeWJyCdj23DV3598X72RYiK3D6muWURck16jqeA
49
+ BRvUFuFHOwa/yA==
50
+ -----END CERTIFICATE-----
51
+
52
+ post_install_message:
28
53
  authors:
54
+ - Austin Ziegler
29
55
  - Matt Lyon
30
56
  files:
57
+ - History.txt
58
+ - Install.txt
59
+ - Licence.txt
60
+ - Manifest.txt
31
61
  - Rakefile
32
- - README
33
- - CHANGELOG
34
- - LICENSE
62
+ - Readme.txt
35
63
  - lib/color.rb
64
+ - lib/color/cmyk.rb
65
+ - lib/color/css.rb
66
+ - lib/color/grayscale.rb
67
+ - lib/color/hsl.rb
68
+ - lib/color/palette.rb
69
+ - lib/color/palette/adobecolor.rb
70
+ - lib/color/palette/gimp.rb
71
+ - lib/color/palette/monocontrast.rb
72
+ - lib/color/rgb-colors.rb
73
+ - lib/color/rgb.rb
74
+ - lib/color/rgb/metallic.rb
75
+ - lib/color/yiq.rb
76
+ - setup.rb
77
+ - test/test_adobecolor.rb
78
+ - test/test_all.rb
79
+ - test/test_cmyk.rb
36
80
  - test/test_color.rb
37
- test_files: []
38
-
39
- rdoc_options: []
40
-
41
- extra_rdoc_files: []
42
-
81
+ - test/test_css.rb
82
+ - test/test_gimp.rb
83
+ - test/test_grayscale.rb
84
+ - test/test_hsl.rb
85
+ - test/test_monocontrast.rb
86
+ - test/test_rgb.rb
87
+ - test/test_yiq.rb
88
+ test_files:
89
+ - test/test_all.rb
90
+ rdoc_options:
91
+ - --main
92
+ - README.txt
93
+ extra_rdoc_files:
94
+ - History.txt
95
+ - Install.txt
96
+ - Licence.txt
97
+ - Readme.txt
43
98
  executables: []
44
99
 
45
100
  extensions: []
46
101
 
47
102
  requirements: []
48
103
 
49
- dependencies: []
50
-
104
+ dependencies:
105
+ - !ruby/object:Gem::Dependency
106
+ name: archive-tar-minitar
107
+ version_requirement:
108
+ version_requirements: !ruby/object:Gem::Version::Requirement
109
+ requirements:
110
+ - - ~>
111
+ - !ruby/object:Gem::Version
112
+ version: 0.5.1
113
+ version:
114
+ - !ruby/object:Gem::Dependency
115
+ name: hoe
116
+ version_requirement:
117
+ version_requirements: !ruby/object:Gem::Version::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: 1.3.0
122
+ version:
@@ -0,0 +1,3 @@
1
+ i�6��R,�:���>�
2
+ �r��qMCE�Rկ�(
3
+ ������T���y)��C*�2�JZno4� ����9�Э@��ݳ��y����/`���g�g��K g�+�-�0��3a�t�o.�����c�P:EU�����5�}-�#B �Nf���B76@׌���G4s��ZZ��U����l� *�ꈣ����Uy|�=E73@������X�����:��m���#�z��F��^���Y3x<�����p���Zq�m~��@�N"
data/CHANGELOG DELETED
@@ -1,4 +0,0 @@
1
- === 24 July 2006
2
- * Initial import of code written 23 July.
3
- * Adding LICENSE, README, CHANGELOG files.
4
- * Added Rakefile, Basic Conversion Test for hex.
data/LICENSE DELETED
@@ -1,7 +0,0 @@
1
- Copyright (c) 2006 Matt Lyon
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README DELETED
@@ -1,41 +0,0 @@
1
- Color
2
- =====
3
-
4
- A simple library for dealing with colors. Currently it features:
5
-
6
- Conversion:
7
- RGB Int <-> RGB Hex
8
- HSL <-> RGB
9
- RGB <-> CMYK
10
- RGB -> HSV
11
-
12
- Manipulation:
13
- Mixing colors
14
- Adjusting Hue, Saturation, or Lightness values of a color
15
-
16
- Future plans include #to_web_safe, a palette (fe: Color.new(:black)),
17
- color wheel traversing ( Color.new(:red).compliment == Color.new(:green) ),
18
- and possibly color scheme suggestions (analagous, etc).
19
-
20
- Usage
21
- =====
22
-
23
- require 'color'
24
- => true
25
- red = Color.new('ff0000')
26
- => #<Color:0x352fd0 @hue=0.0, @lightness=0.5, @rgb=[255, 0, 0], @saturation=1.0>
27
- yellow = Color.new('ffff00')
28
- => #<Color:0x34bb18 @hue=0.166666666666667, @lightness=0.5, @rgb=[255, 255, 0], @saturation=1.0>
29
- orange = red.mix_with yellow, 0.5
30
- => #<Color:0x33dea0 @hue=0.0830065359477123, @lightness=0.5, @rgb=[255, 127, 0], @saturation=1.0>
31
- orange.to_hex
32
- => "#ff7f00"
33
- orange.lightness += 0.2
34
- => 0.7
35
- orange.to_hex
36
- => "#ffb266"
37
-
38
- Warning
39
- =======
40
-
41
- This is alpha-quality software. It works according to general poking and prodding, but at this point all of half a morning has been spent on it. The API is subject to change.