pigment 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +26 -1
  3. data/lib/colors.rb +1 -0
  4. data/lib/pigment.rb +10 -11
  5. metadata +12 -12
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fa93c0cb53d8ea02c5ac2fc22ef5ec38e8813312
4
+ data.tar.gz: a8a5c9ab08d5bd83c724648d59b7690006340eae
5
+ SHA512:
6
+ metadata.gz: 80e7100b40073f0324781c73a3fa339d7e11925338235793422c32f7eae455f6023b96b0ae8d65749c61dc4e0e723d475f2b602bbe875e9fbc785603e72222ac
7
+ data.tar.gz: 49f28e87d806019f82df6018344c4d8a7fe078dc46fb4a4b088a8c303f7fadbd6ceeb327671b94e27a764316542973568c8d04cde2bd797e03d373453ce21cec
data/README.md CHANGED
@@ -6,4 +6,29 @@ To install:
6
6
  gem install pigment
7
7
  ```
8
8
 
9
- <a href='http://www.pledgie.com/campaigns/18945'><img alt='Click here to lend your support to: pigment (ruby gem) and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/18945.png?skin_name=chrome' border='0' /></a>
9
+ <a href='http://www.pledgie.com/campaigns/18945'><img alt='Click here to lend your support to: pigment (ruby gem) and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/18945.png?skin_name=chrome' border='0' /></a>
10
+
11
+ # License
12
+
13
+ (The MIT License)
14
+
15
+ Copyright &copy; 2012 Pedro Miranda
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining
18
+ a copy of this software and associated documentation files (the
19
+ 'Software'), to deal in the Software without restriction, including
20
+ without limitation the rights to use, copy, modify, merge, publish,
21
+ distribute, sublicense, and/or sell copies of the Software, and to
22
+ permit persons to whom the Software is furnished to do so, subject to
23
+ the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be
26
+ included in all copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
29
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
32
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
33
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
34
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -742,6 +742,7 @@ module Pigment
742
742
  self[:WildWatermelon] = '#FC6C85'
743
743
  self[:Wine] = '#722F37'
744
744
  self[:Wisteria] = '#C9A0DC'
745
+ self[:WPFButton] = '#DDDDDD'
745
746
  self[:Xanadu] = '#738678'
746
747
  self[:YaleBlue] = '#0F4D92'
747
748
  self[:YellowGreen] = '#9ACD32'
@@ -1,5 +1,5 @@
1
1
  module Pigment
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'.freeze
3
3
 
4
4
  class Color
5
5
 
@@ -27,7 +27,7 @@ module Pigment
27
27
  end
28
28
  end
29
29
 
30
- # Selectors and Setters.
30
+ # Getters and Setters.
31
31
  %w'r g b a'.each_with_index do |m, i|
32
32
  define_method("#{m}", ->() { @color[i] })
33
33
  define_method("#{m}=", ->(value) { @color[i] = value if value.is_a?(Float) && (0.0..1.0).include?(value) })
@@ -37,18 +37,18 @@ module Pigment
37
37
  define_method("#{m}", ->() { hsl[i] })
38
38
  end
39
39
 
40
-
41
- # Returns an array with the rgb components
42
- # @return [Array]
43
- def rgb
44
- @color[0, 3]
40
+ def method_missing(method, *args)
41
+ # Returns an array with the respective rgba components
42
+ # @return [Array]
43
+ super unless method =~ /(a|b|g|r)+/ && args.empty?
44
+ method.size.times.map{ |i| send(method[i]) }
45
45
  end
46
46
 
47
47
  # Return specified color by its name from the named_colors hash.
48
48
  # @param [Symbol] name
49
- # @return [Color]
50
- def self.[](name)
51
- @named_colors[name]
49
+ # @return [Array]
50
+ def self.[](*colors)
51
+ colors.size > 1 ? colors.map { |color| @named_colors[color] } : @named_colors[colors[0]]
52
52
  end
53
53
 
54
54
  # Add name to a color , add it to the named_colors hash and defines a constant.
@@ -72,7 +72,6 @@ module Pigment
72
72
  named_colors.sort
73
73
  end
74
74
 
75
-
76
75
  # Suppress an array of floats by dividing by the greatest color component.
77
76
  # @param [Array] color
78
77
  # @return [Array]
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - P3t3rU5
@@ -10,7 +9,7 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
14
13
  dependencies: []
15
14
  description: A rgb color gem, with a list of 750 different colors defined within 869
16
15
  names.
@@ -26,31 +25,32 @@ files:
26
25
  - README.md
27
26
  homepage: https://github.com/P3t3rU5/pigment
28
27
  licenses: []
29
- post_install_message: ! "+----------------------------------------------------------------------------+\n
28
+ metadata: {}
29
+ post_install_message: "+----------------------------------------------------------------------------+\n
30
30
  \ Thanks for choosing Pigment.\n\n ==========================================================================\n
31
- \ 0.2.1 Changes:\n - Corrected Color#interpolate\n ==========================================================================\n\n
31
+ \ 0.2.2 Changes:\n - Added method chaining for #r, #g, #b and #a methods for
32
+ example \n\t\tcolor.rgggba returns an array with r, g, g, g, b, a.\n - Color[]
33
+ now accepts more than one argument and returns an array of \n\t\tcolors or just
34
+ one color.\n\t\t- Version is now Frozen.\n\t\t- Added license.\n\n ==========================================================================\n\n
32
35
  \ If you like what you see, support us on Pledgie:\n http://www.pledgie.com/campaigns/18945\n\n
33
36
  \ If you find any bugs, please report them on\n https://github.com/P3t3rU5/pigment/issues\n\n+----------------------------------------------------------------------------+\n"
34
37
  rdoc_options: []
35
38
  require_paths:
36
39
  - lib
37
40
  required_ruby_version: !ruby/object:Gem::Requirement
38
- none: false
39
41
  requirements:
40
- - - ! '>='
42
+ - - '>='
41
43
  - !ruby/object:Gem::Version
42
44
  version: '0'
43
45
  required_rubygems_version: !ruby/object:Gem::Requirement
44
- none: false
45
46
  requirements:
46
- - - ! '>='
47
+ - - '>='
47
48
  - !ruby/object:Gem::Version
48
49
  version: '0'
49
50
  requirements: []
50
51
  rubyforge_project:
51
- rubygems_version: 1.8.24
52
+ rubygems_version: 2.0.2
52
53
  signing_key:
53
- specification_version: 3
54
+ specification_version: 4
54
55
  summary: A rgb color gem, with a list of 750 different colors.
55
56
  test_files: []
56
- has_rdoc: