kmandrup-colorist 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kmandrup-colorist}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Bleigh", "oleg dashevskii", "Slippy Douglas", "Kristian Mandrup"]
12
- s.date = %q{2010-05-27}
12
+ s.date = %q{2010-05-29}
13
13
  s.description = %q{Colorist is a library built to handle the easy conversion and manipulation of colors with a special emphasis on W3C standards and CSS-style hex color notation.}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -374,17 +374,24 @@ module Colorist
374
374
  }
375
375
 
376
376
  def self.color(name, *options)
377
- name = hexify(name.to_s)
377
+ name = hexify(name.to_s) if hex?(name)
378
378
  options.flatten!
379
379
  col = name
380
- col = COLORS[name.downcase.strip] if !hex? name
380
+ puts "name: #{name}"
381
+ col = COLORS[name.downcase.strip] if !hex?(name)
381
382
  raise ArgumentError, "The color name '#{name}' cannot be coerced into a color." if !col
382
383
  res = if options.include?(:hex)
383
384
  col.sub /#/, '0x'
384
385
  else
385
386
  col
386
387
  end
387
- options.include?(:lower) ? res.downcase : res
388
+ res = options.include?(:lower) ? res.downcase : res
389
+ res = options.include?(:simple) ? remove(res, '#', '0x') : res
390
+ end
391
+
392
+ def self.remove(txt, *args)
393
+ args.each{|a| txt.gsub! a, '' }
394
+ txt
388
395
  end
389
396
 
390
397
  def self.to_color(hex_number)
@@ -1,4 +1,7 @@
1
+ require '../lib/kmandrup-colorist'
2
+
1
3
  # puts Colorist::ColorNames.color('0xfff', :lower)
4
+ # puts Colorist::ColorNames.color('blue', :lower, :simple)
2
5
  # puts x = Colorist::ColorNames.color(:'#FFFFAA', :lower)
3
6
  # puts x = Colorist::ColorNames.color('0xFFFFAA', [:hex, :lower])
4
7
  # puts x = Colorist::ColorNames.color(:red, :hex, :lower)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Bleigh
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-05-27 00:00:00 -04:00
20
+ date: 2010-05-29 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies: []
23
23