color 1.4.1 → 1.4.2
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.tar.gz.sig +3 -3
- data/.gemtest +0 -0
- data/.hoerc +2 -0
- data/Contributing.rdoc +57 -0
- data/{History.txt → History.rdoc} +18 -13
- data/{Licence.txt → Licence.rdoc} +4 -4
- data/Manifest.txt +4 -6
- data/README.rdoc +45 -0
- data/Rakefile +29 -111
- data/lib/color.rb +4 -16
- data/lib/color/cmyk.rb +0 -12
- data/lib/color/css.rb +0 -12
- data/lib/color/grayscale.rb +3 -17
- data/lib/color/hsl.rb +0 -12
- data/lib/color/palette.rb +0 -12
- data/lib/color/palette/adobecolor.rb +0 -12
- data/lib/color/palette/gimp.rb +0 -12
- data/lib/color/palette/monocontrast.rb +3 -15
- data/lib/color/rgb-colors.rb +0 -12
- data/lib/color/rgb.rb +4 -16
- data/lib/color/rgb/metallic.rb +0 -12
- data/lib/color/yiq.rb +1 -13
- data/test/test_adobecolor.rb +9 -23
- data/test/test_cmyk.rb +20 -36
- data/test/test_color.rb +4 -16
- data/test/test_css.rb +3 -15
- data/test/test_gimp.rb +8 -22
- data/test/test_grayscale.rb +11 -27
- data/test/test_hsl.rb +20 -38
- data/test/test_monocontrast.rb +13 -25
- data/test/test_rgb.rb +20 -32
- data/test/test_yiq.rb +12 -24
- metadata +271 -99
- metadata.gz.sig +1 -3
- data/Install.txt +0 -18
- data/README.txt +0 -32
- data/setup.rb +0 -1585
- data/test/test_all.rb +0 -23
data.tar.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
xn)Zn����Q�P���VU�GO�(�%ȩ0(�i[�p�̽p�[�q��:
|
2
|
+
�ۀ�)�����屮{�Yړ���}�:���d���E������'I����2��6�;��d$�H��8ٚ�7/�먇m���=�$&`D�7�8̼�<����}U'!~dZ������ٟ�wr����ѩc2嬼�]g�L��G���
|
3
|
+
���G�I@�iLDcP��Pÿ���ӣB<Y�®�(���,�;��r_�3��.��
|
data/.gemtest
ADDED
File without changes
|
data/.hoerc
ADDED
data/Contributing.rdoc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
== Contributing
|
2
|
+
|
3
|
+
I value any contribution to Color you can provide: a bug report, a feature
|
4
|
+
request, or code contributions.
|
5
|
+
|
6
|
+
Code contributions to Color are especially <del>welcome</del>encouraged.
|
7
|
+
Because Color is a complex codebase, there are a few guidelines:
|
8
|
+
|
9
|
+
* Changes <strong>will not</strong> be accepted without tests.
|
10
|
+
* Match my coding style.
|
11
|
+
* Use a thoughtfully-named topic branch that contains your change. Rebase your
|
12
|
+
commits into logical chunks as necessary.
|
13
|
+
* Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
|
14
|
+
* Do not change the version number; when your patch is accepted and a release
|
15
|
+
is made, the version will be updated at that point.
|
16
|
+
* Submit a GitHub pull request with your changes.
|
17
|
+
* New features require new documentation.
|
18
|
+
|
19
|
+
=== Test Dependencies
|
20
|
+
|
21
|
+
To run the test suite, you will need to install the development dependencies
|
22
|
+
for Color. If you have Bundler, you can accomplish this easily:
|
23
|
+
|
24
|
+
$ bundle install
|
25
|
+
|
26
|
+
Color uses Ryan Davis’s excellent {Hoe}[https://github.com/seattlerb/hoe]
|
27
|
+
to manage the release process, and it adds a number of rake tasks. You will
|
28
|
+
mostly be interested in:
|
29
|
+
|
30
|
+
$ rake
|
31
|
+
|
32
|
+
which runs the tests the same way that:
|
33
|
+
|
34
|
+
$ rake spec
|
35
|
+
$ rake test
|
36
|
+
$ rake travis
|
37
|
+
|
38
|
+
will do.
|
39
|
+
|
40
|
+
=== Workflow
|
41
|
+
|
42
|
+
Here's the most direct way to get your work merged into the project:
|
43
|
+
|
44
|
+
* Fork the project.
|
45
|
+
* Clone down your fork (+git clone git://github.com/<username>/color.git+).
|
46
|
+
* Create a topic branch to contain your change (+git checkout -b my\_awesome\_feature+).
|
47
|
+
* Hack away, add tests. Not necessarily in that order.
|
48
|
+
* Make sure everything still passes by running `rake`.
|
49
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
50
|
+
* Push the branch up (+git push origin my\_awesome\_feature+).
|
51
|
+
* Create a pull request against halostatue/color and describe what your
|
52
|
+
change does and the why you think it should be merged.
|
53
|
+
|
54
|
+
=== Contributors
|
55
|
+
|
56
|
+
* Austin Ziegler created color-tools.
|
57
|
+
* Matt Lyons created color.
|
@@ -1,8 +1,19 @@
|
|
1
|
-
==
|
1
|
+
== 1.4.2 / 2013-06-30
|
2
|
+
|
3
|
+
Maintenance:
|
4
|
+
* Modernized Hoe installation of Color, removing some dependencies.
|
5
|
+
* Switched to Minitest.
|
6
|
+
* Turned on Travis CI.
|
7
|
+
* Started using Code Climate.
|
8
|
+
* Small code formatting cleanup that touched pretty much every file.
|
9
|
+
|
10
|
+
== 1.4.1 / 2010-02-03
|
11
|
+
|
2
12
|
* Imported to github.
|
3
13
|
* Converted to Hoe 2.5 spec format.
|
4
14
|
|
5
|
-
==
|
15
|
+
== 1.4.0 / 2007-02-11
|
16
|
+
|
6
17
|
* Merged Austin Ziegler's color-tools library (previously part of the Ruby
|
7
18
|
PDF Tools project) with Matt Lyon's color library.
|
8
19
|
- The HSL implementation from the Color class has been merged into
|
@@ -39,13 +50,15 @@
|
|
39
50
|
* Added an Adobe Color swatch (Photoshop) palette reader,
|
40
51
|
Color::Palette::AdobeColor (for .aco files only).
|
41
52
|
|
42
|
-
== Color 0.1.0 / 2006
|
53
|
+
== Color 0.1.0 / 2006-08-05
|
54
|
+
|
43
55
|
* Added HSL (degree, percent, percent) interface.
|
44
56
|
* Removed RGB instance variable; color is managed internally as HSL floating
|
45
57
|
point.
|
46
58
|
* Tests!
|
47
59
|
|
48
60
|
== color-tools 1.3.0
|
61
|
+
|
49
62
|
* Added new metallic colours suggested by Jim Freeze <jfn@freeze.org>. These
|
50
63
|
are in the namespace Color::Metallic.
|
51
64
|
* Colours that were defined in the Color namespace (e.g., Color::Red,
|
@@ -76,18 +89,10 @@
|
|
76
89
|
conversions from YIQ to other colour spaces.
|
77
90
|
|
78
91
|
== color-tools 1.1.0
|
92
|
+
|
79
93
|
* Added color/palette/gimp to support the reading and use of GIMP color
|
80
94
|
palettes.
|
81
95
|
|
82
96
|
== color-tools 1.0.0
|
83
|
-
* Initial release.
|
84
|
-
|
85
|
-
== Copyright
|
86
|
-
Color
|
87
|
-
Colour Management with Ruby
|
88
|
-
http://rubyforge.org/projects/color
|
89
97
|
|
90
|
-
|
91
|
-
distribution for full licensing information.
|
92
|
-
|
93
|
-
Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
98
|
+
* Initial release.
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
Colour management in Ruby
|
3
|
-
http://rubyforge.org/projects/color/
|
1
|
+
== Licence
|
4
2
|
|
5
|
-
|
3
|
+
This software is available under an MIT-style licence.
|
4
|
+
|
5
|
+
* Copyright 2005–2013 Austin Ziegler, Matt Lyon, and other contributors
|
6
6
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
8
8
|
this software and associated documentation files (the "Software"), to deal in
|
data/Manifest.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Licence.
|
1
|
+
.hoerc
|
2
|
+
History.rdoc
|
3
|
+
Licence.rdoc
|
4
4
|
Manifest.txt
|
5
|
-
README.
|
5
|
+
README.rdoc
|
6
6
|
Rakefile
|
7
7
|
lib/color.rb
|
8
8
|
lib/color/cmyk.rb
|
@@ -17,9 +17,7 @@ lib/color/rgb-colors.rb
|
|
17
17
|
lib/color/rgb.rb
|
18
18
|
lib/color/rgb/metallic.rb
|
19
19
|
lib/color/yiq.rb
|
20
|
-
setup.rb
|
21
20
|
test/test_adobecolor.rb
|
22
|
-
test/test_all.rb
|
23
21
|
test/test_cmyk.rb
|
24
22
|
test/test_color.rb
|
25
23
|
test/test_css.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
= Color
|
2
|
+
|
3
|
+
home :: http://color.rubyforge.org
|
4
|
+
code :: https://github.com/halostatue/color
|
5
|
+
bugs :: https://github.com/halostatue/color/issues
|
6
|
+
rdoc :: http://rubydoc.info/github/halostatue/color
|
7
|
+
code climate :: {<img src="https://codeclimate.com/github/halostatue/color.png" />}[https://codeclimate.com/github/halostatue/color]
|
8
|
+
continuous integration :: {<img src="https://travis-ci.org/halostatue/color.png" />}[https://travis-ci.org/halostatue/color]
|
9
|
+
|
10
|
+
== Description
|
11
|
+
|
12
|
+
Color is a Ruby library to provide basic RGB, CMYK, HSL, and other colourspace
|
13
|
+
manipulation support to applications that require it. It also provides 152
|
14
|
+
named RGB colours (184 with spelling variations) that are commonly supported in
|
15
|
+
HTML, SVG, and X11 applications. A technique for generating monochromatic
|
16
|
+
contrasting palettes is also included.
|
17
|
+
|
18
|
+
The capabilities of the Color library are limited to pure mathematical
|
19
|
+
manipulation of the colours based on colour theory without reference to colour
|
20
|
+
profiles (such as sRGB or Adobe RGB). For most purposes, when working with the
|
21
|
+
RGB and HSL colours, this won't matter. However, some colour models (like CIE
|
22
|
+
L*a*b*) are not supported because Color does not yet support colour profiles,
|
23
|
+
giving no meaningful way to convert colours in absolute colour spaces (like
|
24
|
+
L*a*b*, XYZ) to non-absolute colour spaces (like RGB).
|
25
|
+
|
26
|
+
Color version 1.4.2 updates the release and install as a RubyGem to remove an
|
27
|
+
unnecessary dependency, adds code climate analysis, and Travis CI support.
|
28
|
+
|
29
|
+
== History
|
30
|
+
|
31
|
+
Color is the result of a project merge between color.rb 0.1.0 by
|
32
|
+
Matt Lyon and color-tools 1.3 by Austin Ziegler. Please see History.txt for
|
33
|
+
details on the changes this merge brings.
|
34
|
+
|
35
|
+
Color::Palette::MonoContrast was developed based on techniques described by
|
36
|
+
Andy “Malarkey” Clarke[1], implemented in JavaScript by Steve G. Chipman at
|
37
|
+
SlayerOffice[2] and by Patrick Fitzgerald of BarelyFitz[3] in PHP.
|
38
|
+
|
39
|
+
[1] http://www.stuffandnonsense.co.uk/archives/creating_colour_palettes.html
|
40
|
+
[2] http://slayeroffice.com/tools/color_palette/
|
41
|
+
[3] http://www.barelyfitz.com/projects/csscolor/
|
42
|
+
|
43
|
+
:include: Contributing.rdoc
|
44
|
+
|
45
|
+
:include: Licence.rdoc
|
data/Rakefile
CHANGED
@@ -1,116 +1,34 @@
|
|
1
|
-
|
2
|
-
#--
|
3
|
-
# Color
|
4
|
-
# Colour Management with Ruby
|
5
|
-
# http://rubyforge.org/projects/color
|
6
|
-
#
|
7
|
-
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
-
# distribution for full licensing information.
|
9
|
-
#
|
10
|
-
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
-
#++
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
12
2
|
|
13
3
|
require 'rubygems'
|
14
4
|
require 'hoe'
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
self.
|
35
|
-
|
36
|
-
self.
|
37
|
-
self.
|
38
|
-
self.
|
39
|
-
|
40
|
-
extra_dev_deps << [
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
self.need_tar = false
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Build a Color .tar.gz distribution."
|
48
|
-
task :tar => [ PKG_TAR ]
|
49
|
-
file PKG_TAR => [ :test ] do |t|
|
50
|
-
require 'archive/tar/minitar'
|
51
|
-
require 'zlib'
|
52
|
-
files = MANIFEST.map { |f|
|
53
|
-
fn = File.join(PKG_DIST, f)
|
54
|
-
tm = File.stat(f).mtime
|
55
|
-
|
56
|
-
if File.directory?(f)
|
57
|
-
{ :name => fn, :mode => 0755, :dir => true, :mtime => tm }
|
58
|
-
else
|
59
|
-
mode = if f =~ %r{^bin}
|
60
|
-
0755
|
61
|
-
else
|
62
|
-
0644
|
63
|
-
end
|
64
|
-
data = File.read(f)
|
65
|
-
{ :name => fn, :mode => mode, :data => data, :size => data.size,
|
66
|
-
:mtime => tm }
|
67
|
-
end
|
68
|
-
}
|
69
|
-
|
70
|
-
begin
|
71
|
-
unless File.directory?(File.dirname(t.name))
|
72
|
-
require 'fileutils'
|
73
|
-
File.mkdir_p File.dirname(t.name)
|
74
|
-
end
|
75
|
-
tf = File.open(t.name, 'wb')
|
76
|
-
gz = Zlib::GzipWriter.new(tf)
|
77
|
-
tw = Archive::Tar::Minitar::Writer.new(gz)
|
78
|
-
|
79
|
-
files.each do |entry|
|
80
|
-
if entry[:dir]
|
81
|
-
tw.mkdir(entry[:name], entry)
|
82
|
-
else
|
83
|
-
tw.add_file_simple(entry[:name], entry) { |os|
|
84
|
-
os.write(entry[:data])
|
85
|
-
}
|
86
|
-
end
|
87
|
-
end
|
88
|
-
ensure
|
89
|
-
tw.close if tw
|
90
|
-
gz.close if gz
|
91
|
-
end
|
92
|
-
end
|
93
|
-
task :package => [ PKG_TAR ]
|
94
|
-
|
95
|
-
desc "Build the manifest file from the current set of files."
|
96
|
-
task :build_manifest do |t|
|
97
|
-
require 'find'
|
98
|
-
|
99
|
-
paths = []
|
100
|
-
Find.find(".") do |path|
|
101
|
-
next if File.directory?(path)
|
102
|
-
next if path =~ /\.svn/
|
103
|
-
next if path =~ /\.git/
|
104
|
-
next if path =~ /\.hoerc/
|
105
|
-
next if path =~ /\.swp$/
|
106
|
-
next if path =~ %r{coverage/}
|
107
|
-
next if path =~ /~$/
|
108
|
-
paths << path.sub(%r{^\./}, '')
|
109
|
-
end
|
110
|
-
|
111
|
-
File.open("Manifest.txt", "w") do |f|
|
112
|
-
f.puts paths.sort.join("\n")
|
113
|
-
end
|
114
|
-
|
115
|
-
puts paths.sort.join("\n")
|
6
|
+
Hoe.plugin :bundler
|
7
|
+
Hoe.plugin :doofus
|
8
|
+
Hoe.plugin :email
|
9
|
+
Hoe.plugin :gemspec2
|
10
|
+
Hoe.plugin :git
|
11
|
+
Hoe.plugin :minitest
|
12
|
+
Hoe.plugin :rubyforge
|
13
|
+
Hoe.plugin :travis
|
14
|
+
|
15
|
+
Hoe.spec 'color' do
|
16
|
+
developer "Austin Ziegler", "austin@rubyforge.org"
|
17
|
+
developer "Matt Lyon", "matt@postsomnia.com"
|
18
|
+
|
19
|
+
self.remote_rdoc_dir = '.'
|
20
|
+
self.rsync_args << ' --exclude=statsvn/'
|
21
|
+
|
22
|
+
self.history_file = 'History.rdoc'
|
23
|
+
self.readme_file = 'README.rdoc'
|
24
|
+
self.extra_rdoc_files = FileList["*.rdoc"].to_a
|
25
|
+
|
26
|
+
self.extra_dev_deps << ['hoe-bundler', '~> 1.2']
|
27
|
+
self.extra_dev_deps << ['hoe-doofus', '~> 1.0']
|
28
|
+
self.extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
29
|
+
self.extra_dev_deps << ['hoe-git', '~> 1.5']
|
30
|
+
self.extra_dev_deps << ['hoe-rubygems', '~> 1.0']
|
31
|
+
self.extra_dev_deps << ['hoe-travis', '~> 1.2']
|
32
|
+
self.extra_dev_deps << ['minitest', '~> 5.0']
|
33
|
+
self.extra_dev_deps << ['rake', '~> 10.0']
|
116
34
|
end
|
data/lib/color.rb
CHANGED
@@ -1,21 +1,9 @@
|
|
1
1
|
# :title: Color -- Colour Management with Ruby
|
2
|
-
# :main: README.
|
3
|
-
|
4
|
-
#--
|
5
|
-
# Color
|
6
|
-
# Colour management with Ruby
|
7
|
-
# http://rubyforge.org/projects/color
|
8
|
-
# Version 1.4.1
|
9
|
-
#
|
10
|
-
# Licensed under a MIT-style licence. See Licence.txt in the main
|
11
|
-
# distribution for full licensing information.
|
12
|
-
#
|
13
|
-
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
14
|
-
#++
|
2
|
+
# :main: README.rdoc
|
15
3
|
|
16
4
|
# = Colour Management with Ruby
|
17
5
|
module Color
|
18
|
-
COLOR_VERSION = '1.4.
|
6
|
+
COLOR_VERSION = '1.4.2'
|
19
7
|
|
20
8
|
class RGB; end
|
21
9
|
class CMYK; end
|
@@ -82,7 +70,7 @@ module Color
|
|
82
70
|
normalize_to_range(value, 0..255).to_i
|
83
71
|
end
|
84
72
|
alias normalize_8bit normalize_byte
|
85
|
-
|
73
|
+
|
86
74
|
# Normalize the value to the range (0) .. (65535).
|
87
75
|
def normalize_word(value)
|
88
76
|
normalize_to_range(value, 0..65535).to_i
|
@@ -115,7 +103,7 @@ module Color
|
|
115
103
|
end
|
116
104
|
|
117
105
|
# Provides a thin veneer over the Color module to make it seem like this
|
118
|
-
# is Color 0.1.0 (a class) and not Color 1.4
|
106
|
+
# is Color 0.1.0 (a class) and not Color 1.4 (a module). This
|
119
107
|
# "constructor" will be removed in the future.
|
120
108
|
#
|
121
109
|
# mode = :hsl:: +values+ must be an array of [ hue deg, sat %, lum % ].
|
data/lib/color/cmyk.rb
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# Color
|
3
|
-
# Colour management with Ruby
|
4
|
-
# http://rubyforge.org/projects/color
|
5
|
-
# Version 1.4.1
|
6
|
-
#
|
7
|
-
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
-
# distribution for full licensing information.
|
9
|
-
#
|
10
|
-
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
-
#++
|
12
|
-
|
13
1
|
# An CMYK colour object. CMYK (cyan, magenta, yellow, and black) colours are
|
14
2
|
# based on additive percentages of ink. A CMYK colour of (0.3, 0, 0.8, 0.3)
|
15
3
|
# would be mixed from 30% cyan, 0% magenta, 80% yellow, and 30% black.
|
data/lib/color/css.rb
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# Color
|
3
|
-
# Colour management with Ruby
|
4
|
-
# http://rubyforge.org/projects/color
|
5
|
-
# Version 1.4.1
|
6
|
-
#
|
7
|
-
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
-
# distribution for full licensing information.
|
9
|
-
#
|
10
|
-
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
-
#++
|
12
|
-
|
13
1
|
require 'color'
|
14
2
|
|
15
3
|
# This namespace contains some CSS colour names.
|
data/lib/color/grayscale.rb
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
#--
|
2
|
-
# Color
|
3
|
-
# Colour management with Ruby
|
4
|
-
# http://rubyforge.org/projects/color
|
5
|
-
# Version 1.4.1
|
6
|
-
#
|
7
|
-
# Licensed under a MIT-style licence. See Licence.txt in the main
|
8
|
-
# distribution for full licensing information.
|
9
|
-
#
|
10
|
-
# Copyright (c) 2005 - 2010 Austin Ziegler and Matt Lyon
|
11
|
-
#++
|
12
|
-
|
13
1
|
# A colour object representing shades of grey. Used primarily in PDF
|
14
2
|
# document creation.
|
15
3
|
class Color::GrayScale
|
@@ -195,7 +183,7 @@ class Color::GrayScale
|
|
195
183
|
# The subtraction is done using the grayscale accessor methods to ensure a
|
196
184
|
# valid colour in the result.
|
197
185
|
def -(other)
|
198
|
-
other = other.to_grayscale
|
186
|
+
other = other.to_grayscale
|
199
187
|
ng = self.dup
|
200
188
|
ng.g -= other.g
|
201
189
|
ng
|
@@ -206,7 +194,5 @@ class Color::GrayScale
|
|
206
194
|
end
|
207
195
|
end
|
208
196
|
|
209
|
-
|
210
|
-
|
211
|
-
GreyScale = GrayScale
|
212
|
-
end
|
197
|
+
# A synonym for Color::GrayScale.
|
198
|
+
Color::GreyScale = Color::GrayScale
|