color 1.4.1 → 1.8

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 696c2ac0e8282a88cbe1626c779ad336b679f5a1
4
+ data.tar.gz: c9b3d3786799d258a32120f1560ed16c29a40f7f
5
+ SHA512:
6
+ metadata.gz: b78ecb062c1ddcc02a98d6b5aad1e060f0f1276dfd82f3f28f2f7c572659dcf98ef9853d519607fee8c44623de006604e6028dfe43d6ab765dc362a346c69978
7
+ data.tar.gz: f08e750ae6fbb4ac464f6de6657f30bab8e7866fe072aa948c828da8e5881305eaaa254d7e88ca7d2b60fa2aa569fa616a51f836fe4d7f131306493a4a7962ae
data/.autotest ADDED
@@ -0,0 +1,5 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+
3
+ Autotest.add_hook :initialize do |at|
4
+ at.testlib = ".minitest"
5
+ end
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ service_name: travis-ci
data/.gemtest ADDED
File without changes
data/.hoerc ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ exclude: !ruby/regexp /(tmp|swp)$|CVS|TAGS|\.(svn|git|hg|DS_Store|idea)|Gemfile\.lock|research\/|\.gemspec$/
data/.minitest.rb ADDED
@@ -0,0 +1,2 @@
1
+ gem "minitest"
2
+ require "minitest/autorun"
data/.travis.yml ADDED
@@ -0,0 +1,41 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.3
5
+ - 2.1.7
6
+ - 2.0.0-p647
7
+ - ruby-head
8
+ - jruby-9.0
9
+ - jruby-head
10
+ - rbx-2
11
+ - jruby-19mode
12
+ - 1.9.3
13
+ - 1.8.7
14
+ - jruby-18mode
15
+ - ree
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: 1.9.3
19
+ - rvm: rbx-2
20
+ - rvm: jruby-head
21
+ - rvm: ruby-head
22
+ gemfile:
23
+ - Gemfile
24
+ before_script:
25
+ - |
26
+ case "${TRAVIS_RUBY_VERSION}" in
27
+ rbx*)
28
+ gem install psych
29
+ ;;
30
+ esac
31
+ - rake travis:before -t
32
+ script: rake travis
33
+ after_script:
34
+ - rake travis:after -t
35
+ notifications:
36
+ email:
37
+ recipients:
38
+ - halostatue@gmail.com
39
+ on_success: change
40
+ on_failure: always
41
+ sudo: false
@@ -0,0 +1,41 @@
1
+ == Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct.
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct. By adopting this Code of Conduct,
26
+ project maintainers commit themselves to fairly and consistently applying these
27
+ principles to every aspect of managing this project. Project maintainers who do
28
+ not follow or enforce the Code of Conduct may be permanently removed from the
29
+ project team.
30
+
31
+ This code of conduct applies both within project spaces and in public spaces
32
+ when an individual is representing the project or its community.
33
+
34
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
35
+ reported by opening an issue or contacting one or more of the project
36
+ maintainers.
37
+
38
+ This Code of Conduct is adapted from the
39
+ {Contributor Covenant}[http://contributor-covenant.org], version 1.2.0,
40
+ available at
41
+ {http://contributor-covenant.org/version/1/2/0/}[http://contributor-covenant.org/version/1/2/0/].
data/Contributing.rdoc ADDED
@@ -0,0 +1,62 @@
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.
58
+ * Dave Heitzman (contrast comparison)
59
+ * Thomas Sawyer
60
+ * Aaron Hill (CIE94 colour matching)
61
+ * Luke Bennellick
62
+ * Matthew Draper
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # -*- ruby -*-
2
+
3
+ # NOTE: This file is present to keep Travis CI happy. Edits to it will not
4
+ # be accepted.
5
+
6
+ source "https://rubygems.org/"
7
+ gemspec
8
+
9
+ # vim: syntax=ruby
data/History.rdoc ADDED
@@ -0,0 +1,194 @@
1
+ == 1.8 / 2015-10-26
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Add an optional +alpha+ parameter to all #css_rgba calls. Thanks to Luke
6
+ Bennellick (@bennell) and Alexander Popov (@AlexWayfer) for independently
7
+ implemented submissions. Merged from #15.
8
+
9
+ * 2 minor bug fixes:
10
+
11
+ * Improve constant detection to prevent incorrectly identified name
12
+ collisions with various other libraries such as Azure deployment tools.
13
+ Based on work by Matthew Draper (@matthewd) in #24.
14
+
15
+ * Prevent Color.equivalent? comparisons from using non-Color types for
16
+ comparison. Fix provided by Benjamin Guest (@bguest) in #18.
17
+
18
+ * 1 governance change
19
+
20
+ * This project now has a {Code of Conduct}[Code-of-Conduct_rdoc.html]
21
+
22
+ == 1.7.1 / 2014-06-12
23
+
24
+ * Minor enhancements:
25
+
26
+ * Renamed Color::RGB::BeccaPurple to Color::RGB::RebeccaPurple as stipulated
27
+ by Eric Meyer. http://meyerweb.com/eric/thoughts/2014/06/19/rebeccapurple/
28
+ For purposes of backwards compatibility, the previous name is still
29
+ permitted, but its use is strongly discouraged, and it will be removed in
30
+ the Color 2.0 release.
31
+
32
+ == 1.7 / 2014-06-12
33
+
34
+ * Minor enhancements:
35
+ * Added Color::RGB::BeccaPurple (#663399) in honour of Rebecca Meyer, the
36
+ daughter of Eric Meyer, who passed away on the 7th of June, 2014. Her
37
+ favourite colour was purple. #663399becca
38
+ https://twitter.com/meyerweb/status/476089708674428929
39
+ http://www.zeldman.com/2014/06/10/the-color-purple/
40
+ http://discourse.specifiction.org/t/name-663399-becca-purple-in-css4-color/225
41
+
42
+ * Bug fixes:
43
+ * Changed the homepage in the gem to point to github.com instead of
44
+ RubyForge, which has been shut down. Fixes #10, reported by @voxik.
45
+
46
+ == 1.6 / 2014-05-19
47
+
48
+ * Major enhancements:
49
+ * Aaron Hill (@armahillo) implemented the CIE Delta E 94 method by which an
50
+ RGB colour can be asked for the closest matching colour from a list of
51
+ provided colours. Fixes #5.
52
+ * To implement #closest_match and #delta_e94, conversion methods for sRGB to
53
+ XYZ and XYZ to L*a*b* space were implemented. These should be considered
54
+ experimental.
55
+
56
+ * Tooling fixes:
57
+ * Ensured that the gem manifest was up-to-date. Fixes #4 reported by @boutil.
58
+ Thanks!
59
+ * Fixed problems with Travis builds. Note that Ruby 1.9.2 is no longer
60
+ tested. Rubinius remains in a “failure-tolerated” mode.
61
+ * Color 1.6 is, barring security patches, the last release of Color that will
62
+ support Ruby 1.8.
63
+
64
+ == 1.5.1 / 2014-01-28
65
+
66
+ * color 1.5 was a yanked release.
67
+
68
+ * Minor enhancements:
69
+ * Added new methods to Color::RGB to make it so that the default defined
70
+ colours can be looked up by hex, name, or both.
71
+ * Added a method to Color::RGB to extract colours from text by hex, name, or
72
+ both.
73
+ * Added new common methods for colour names. Converted colours do not retain
74
+ names.
75
+ * Restructured color comparisons to use protocols instead of custom
76
+ implementations. This makes it easier to implement new colour classes. To
77
+ make this work, color classes should +include+ Color only need to implement
78
+ <tt>#coerce(other)</tt>, <tt>#to_a</tt>, and supported conversion methods
79
+ (e.g., <tt>#to_rgb</tt>).
80
+ * Added @daveheitzman’s initial implementation of an RGB contrast method as
81
+ an extension file: <tt>require 'color/rgb/contrast'</tt>. This method and
82
+ the value it returns should be considered experimental; it requires further
83
+ examination to ensure that the results produced are consistent with the
84
+ contrast comparisons used in Color::Palette::MonoContrast.
85
+ * Reducing duplicated code.
86
+
87
+ * Bug Fixes:
88
+ * Moved +lib/color/rgb-colors.rb+ to +lib/color/rgb/colors.rb+. This should
89
+ have no impact in general.
90
+ * Improved the way that named colors are specified internally.
91
+ * Fixed bugs with Ruby 1.8.7 that may have been introduced in color 1.4.2.
92
+
93
+ * Tooling Changes:
94
+ * Added simplecov for test coverage analysis.
95
+ * Modernized Travis CI support.
96
+
97
+ == 1.4.2 / 2013-06-30
98
+
99
+ Maintenance:
100
+ * Modernized Hoe installation of Color, removing some dependencies.
101
+ * Switched to Minitest.
102
+ * Turned on Travis CI.
103
+ * Started using Code Climate.
104
+ * Small code formatting cleanup that touched pretty much every file.
105
+
106
+ == 1.4.1 / 2010-02-03
107
+
108
+ * Imported to github.
109
+ * Converted to Hoe 2.5 spec format.
110
+
111
+ == 1.4.0 / 2007-02-11
112
+
113
+ * Merged Austin Ziegler's color-tools library (previously part of the Ruby
114
+ PDF Tools project) with Matt Lyon's color library.
115
+ - The HSL implementation from the Color class has been merged into
116
+ Color::HSL. Color is a module the way it was for color-tools.
117
+ - A thin veneer has been written to allow Color::new to return a Color::HSL
118
+ instance; Color::HSL supports as many methods as possible that were
119
+ previously supported by the Color class.
120
+ - Values that were previously rounded by Color are no longer rounded;
121
+ fractional values matter.
122
+ * Converted to hoe for project management.
123
+ * Moved to the next step of deprecating Color::Name values; printing a
124
+ warning for each use (see the history for color-tools 1.3.0).
125
+ * Print a warning on the access of either VERSION or COLOR_TOOLS_VERSION; the
126
+ version constant is now COLOR_VERSION.
127
+ * Added humanized versions of accessors (e.g., CMYK colours now have both #cyan
128
+ and #c to access the cyan component of the colour; #cyan provides the value
129
+ as a percentage).
130
+ * Added CSS3 formatters for RGB, RGBA, HSL, and HSLA outputs. Note that the
131
+ Color library does not yet have a way of setting alpha opacity, so the
132
+ output for RGBA and HSLA are at full alpha opacity (1.0). The values are
133
+ output with two decimal places.
134
+ * Applied a patch to provide simple arithmetic colour addition and subtraction
135
+ to Color::GrayScale and Color::RGB. The patch was contributed by Jeremy
136
+ Hinegardner <jeremy@hinegardner.org>. This patch also provides the ability to
137
+ return the maximum RGB value as a grayscale colour.
138
+ * Fixed two problems reported by Jean Krohn <jb.krohn@free.fr> against
139
+ color-tools relating to RGB-to-HSL and HSL-to-RGB conversion. (Color and
140
+ color-tools use the same formulas, but the ordering of the calculations is
141
+ slightly different with Color and did not suffer from this problem;
142
+ color-tools was more sensitive to floating-point values and precision
143
+ errors.)
144
+ * Fixed an issue with HSL/RGB conversions reported by Adam Johnson
145
+ <adam.sven.johnson@gmail.com>.
146
+ * Added an Adobe Color swatch (Photoshop) palette reader,
147
+ Color::Palette::AdobeColor (for .aco files only).
148
+
149
+ == Color 0.1.0 / 2006-08-05
150
+
151
+ * Added HSL (degree, percent, percent) interface.
152
+ * Removed RGB instance variable; color is managed internally as HSL floating
153
+ point.
154
+ * Tests!
155
+
156
+ == color-tools 1.3.0
157
+
158
+ * Added new metallic colours suggested by Jim Freeze <jfn@freeze.org>. These
159
+ are in the namespace Color::Metallic.
160
+ * Colours that were defined in the Color namespace (e.g., Color::Red,
161
+ Color::AliceBlue) are now defined in Color::RGB (e.g., Color::RGB::Red,
162
+ Color::RGB::AliceBlue). They are added back to the Color namespace on the
163
+ first use of the old colours and a warning is printed. In version 1.4, this
164
+ warning will be printed on every use of the old colours. In version 1.5,
165
+ the backwards compatible support for colours like Color::Red will be
166
+ removed completely.
167
+ * Added the Color::CSS module, color/css or Color::CSS that provides a name
168
+ lookup of Color::RGB-namespaced constants with Color::CSS[name]. Most of
169
+ these colours (which are mirrored from the Color::RGB default colours) are
170
+ only "officially" recognised under the CSS3 colour module or SVG.
171
+ * Added the Color::HSL colour space and some helper utilities to Color::RGB
172
+ for colour manipulation using the HSL value.
173
+ * Controlled internal value replacement to be between 0 and 1 for all
174
+ colours.
175
+ * Updated Color::Palette::Gimp to more meaningfully deal with duplicate named
176
+ colours. Named colours now return an array of colours.
177
+ * Indicated the plans for some methods and constants out to color-tools 2.0.
178
+ * Added unit tests and fixed a number of hidden bugs because of them.
179
+
180
+ == color-tools 1.2.0
181
+ * Changed installer from a custom-written install.rb to setup.rb
182
+ 3.3.1-modified.
183
+ * Added Color::GreyScale (or Color::GrayScale).
184
+ * Added Color::YIQ. This colour definition is incomplete; it does not have
185
+ conversions from YIQ to other colour spaces.
186
+
187
+ == color-tools 1.1.0
188
+
189
+ * Added color/palette/gimp to support the reading and use of GIMP color
190
+ palettes.
191
+
192
+ == color-tools 1.0.0
193
+
194
+ * Initial release.
@@ -1,8 +1,8 @@
1
- Color
2
- Colour management in Ruby
3
- http://rubyforge.org/projects/color/
1
+ == Licence
4
2
 
5
- Copyright (c) 2005 - 2010 Austin Ziegler, Matt Lyon, and other contributors
3
+ This software is available under an MIT-style licence.
4
+
5
+ * Copyright 2005–2014 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,16 @@
1
- History.txt
2
- Install.txt
3
- Licence.txt
1
+ .autotest
2
+ .coveralls.yml
3
+ .gemtest
4
+ .hoerc
5
+ .minitest.rb
6
+ .travis.yml
7
+ Code-of-Conduct.rdoc
8
+ Contributing.rdoc
9
+ Gemfile
10
+ History.rdoc
11
+ Licence.rdoc
4
12
  Manifest.txt
5
- README.txt
13
+ README.rdoc
6
14
  Rakefile
7
15
  lib/color.rb
8
16
  lib/color/cmyk.rb
@@ -13,13 +21,13 @@ lib/color/palette.rb
13
21
  lib/color/palette/adobecolor.rb
14
22
  lib/color/palette/gimp.rb
15
23
  lib/color/palette/monocontrast.rb
16
- lib/color/rgb-colors.rb
17
24
  lib/color/rgb.rb
25
+ lib/color/rgb/colors.rb
26
+ lib/color/rgb/contrast.rb
18
27
  lib/color/rgb/metallic.rb
19
28
  lib/color/yiq.rb
20
- setup.rb
29
+ test/minitest_helper.rb
21
30
  test/test_adobecolor.rb
22
- test/test_all.rb
23
31
  test/test_cmyk.rb
24
32
  test/test_color.rb
25
33
  test/test_css.rb
data/README.rdoc ADDED
@@ -0,0 +1,52 @@
1
+ = Color
2
+
3
+ home :: https://github.com/halostatue/color
4
+ code :: https://github.com/halostatue/color
5
+ bugs :: https://github.com/halostatue/color/issues
6
+ rdoc :: http://rubydoc.info/github/halostatue/color
7
+ continuous integration :: {<img src="https://travis-ci.org/halostatue/color.png" />}[https://travis-ci.org/halostatue/color]
8
+ test coverage :: {<img src="https://coveralls.io/repos/halostatue/color/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/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 Color library performs purely mathematical manipulation of the colours
19
+ based on colour theory without reference to colour profiles (such as sRGB or
20
+ Adobe RGB). For most purposes, when working with RGB and HSL colour spaces,
21
+ this won't matter. Absolute colour spaces (like CIE L*a*b* and XYZ) and cannot
22
+ be reliably converted to relative colour spaces (like RGB) without colour
23
+ profiles.
24
+
25
+ Color 1.8 adds an alpha parameter to all <tt>#css_rgba</tt> calls, fixes a bug
26
+ exposed by new constant lookup semantics in Ruby 2, and ensures that
27
+ <tt>Color.equivalent?</tt> can only be called on Color instances.
28
+
29
+ Barring bugs introduced in this release, this (really) is the last version of
30
+ color that supports Ruby 1.8, so make sure that your gem specification is set
31
+ properly (to <tt>~> 1.8</tt>) if that matters for your application. This
32
+ version will no longer be supported one year after the release of color 2.0.
33
+
34
+ == History
35
+
36
+ Color is the result of a project merge between color.rb 0.1.0 by
37
+ Matt Lyon and color-tools 1.3 by Austin Ziegler. Please see History.txt for
38
+ details on the changes this merge brings.
39
+
40
+ Color::Palette::MonoContrast was developed based on techniques described by
41
+ Andy “Malarkey” Clarke[1], implemented in JavaScript by Steve G. Chipman at
42
+ SlayerOffice[2] and by Patrick Fitzgerald of BarelyFitz[3] in PHP.
43
+
44
+ [1] http://www.stuffandnonsense.co.uk/archives/creating_colour_palettes.html
45
+ [2] http://slayeroffice.com/tools/color_palette/
46
+ [3] http://www.barelyfitz.com/projects/csscolor/
47
+
48
+ :include: Code-of-Conduct.rdoc
49
+
50
+ :include: Contributing.rdoc
51
+
52
+ :include: Licence.rdoc