timocratic-color 1.4.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.
- data/History.txt +91 -0
- data/Install.txt +20 -0
- data/Licence.txt +29 -0
- data/Manifest.txt +31 -0
- data/Rakefile +116 -0
- data/Readme.txt +33 -0
- data/lib/color.rb +147 -0
- data/lib/color/cmyk.rb +281 -0
- data/lib/color/css.rb +30 -0
- data/lib/color/grayscale.rb +214 -0
- data/lib/color/hsl.rb +223 -0
- data/lib/color/palette.rb +18 -0
- data/lib/color/palette/adobecolor.rb +274 -0
- data/lib/color/palette/gimp.rb +118 -0
- data/lib/color/palette/monocontrast.rb +182 -0
- data/lib/color/rgb-colors.rb +357 -0
- data/lib/color/rgb.rb +455 -0
- data/lib/color/rgb/metallic.rb +45 -0
- data/lib/color/yiq.rb +86 -0
- data/setup.rb +1585 -0
- data/test/test_adobecolor.rb +421 -0
- data/test/test_all.rb +25 -0
- data/test/test_cmyk.rb +130 -0
- data/test/test_color.rb +134 -0
- data/test/test_css.rb +31 -0
- data/test/test_gimp.rb +103 -0
- data/test/test_grayscale.rb +123 -0
- data/test/test_hsl.rb +155 -0
- data/test/test_monocontrast.rb +144 -0
- data/test/test_rgb.rb +346 -0
- data/test/test_yiq.rb +75 -0
- metadata +109 -0
data/test/test_yiq.rb
ADDED
@@ -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
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: timocratic-color
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Austin Ziegler
|
8
|
+
- Matt Lyon
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-01 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: archive-tar-minitar
|
18
|
+
type: :development
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.5.1
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: hoe
|
28
|
+
type: :development
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.12.2
|
35
|
+
version:
|
36
|
+
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).
|
37
|
+
email:
|
38
|
+
- austin@rubyforge.org
|
39
|
+
- matt@postsomnia.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- History.txt
|
46
|
+
- Install.txt
|
47
|
+
- Licence.txt
|
48
|
+
- Readme.txt
|
49
|
+
files:
|
50
|
+
- History.txt
|
51
|
+
- Install.txt
|
52
|
+
- Licence.txt
|
53
|
+
- Manifest.txt
|
54
|
+
- Rakefile
|
55
|
+
- Readme.txt
|
56
|
+
- lib/color.rb
|
57
|
+
- lib/color/cmyk.rb
|
58
|
+
- lib/color/css.rb
|
59
|
+
- lib/color/grayscale.rb
|
60
|
+
- lib/color/hsl.rb
|
61
|
+
- lib/color/palette.rb
|
62
|
+
- lib/color/palette/adobecolor.rb
|
63
|
+
- lib/color/palette/gimp.rb
|
64
|
+
- lib/color/palette/monocontrast.rb
|
65
|
+
- lib/color/rgb-colors.rb
|
66
|
+
- lib/color/rgb.rb
|
67
|
+
- lib/color/rgb/metallic.rb
|
68
|
+
- lib/color/yiq.rb
|
69
|
+
- setup.rb
|
70
|
+
- test/test_adobecolor.rb
|
71
|
+
- test/test_all.rb
|
72
|
+
- test/test_cmyk.rb
|
73
|
+
- test/test_color.rb
|
74
|
+
- test/test_css.rb
|
75
|
+
- test/test_gimp.rb
|
76
|
+
- test/test_grayscale.rb
|
77
|
+
- test/test_hsl.rb
|
78
|
+
- test/test_monocontrast.rb
|
79
|
+
- test/test_rgb.rb
|
80
|
+
- test/test_yiq.rb
|
81
|
+
has_rdoc: true
|
82
|
+
homepage: http://color.rubyforge.org/
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options:
|
85
|
+
- --main
|
86
|
+
- README.txt
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: "0"
|
94
|
+
version:
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: "0"
|
100
|
+
version:
|
101
|
+
requirements: []
|
102
|
+
|
103
|
+
rubyforge_project: color
|
104
|
+
rubygems_version: 1.2.0
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Colour management with Ruby
|
108
|
+
test_files:
|
109
|
+
- test/test_all.rb
|