geo_pattern 1.1.4 → 1.2.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/README.md CHANGED
@@ -26,10 +26,14 @@ Make a new pattern:
26
26
 
27
27
  pattern = GeoPattern.generate("Mastering Markdown")
28
28
 
29
- To specify a base background color:
29
+ To specify a base background color (with a hue and saturation that adjusts depending on the string):
30
30
 
31
31
  pattern = GeoPattern.generate("Mastering Markdown", {:base_color => "#fc0"})
32
32
 
33
+ To use a specific background color (w/o any hue or saturation adjustments):
34
+
35
+ pattern = GeoPattern.generate("Mastering Markdown", {:color => "#fc0"})
36
+
33
37
  To use a specific [pattern generator](#available-patterns):
34
38
 
35
39
  pattern = GeoPattern.generate("Mastering Markdown", {:generator => "sine_waves"})
@@ -130,3 +134,6 @@ https://github.com/btmills/geopatterns-js
130
134
 
131
135
  Bryan Veloso is porting the library to Python:
132
136
  https://github.com/bryanveloso/geopatterns
137
+
138
+ Anand Capur is porting the library to PHP:
139
+ https://github.com/redeyeventures/geopattern-php
@@ -62,17 +62,21 @@ module GeoPattern
62
62
  end
63
63
 
64
64
  def generate_background
65
- hue_offset = map(hex_val(14, 3), 0, 4095, 0, 359)
66
- sat_offset = hex_val(17, 1)
67
- base_color = Color::RGB.from_html(opts[:base_color]).to_hsl
68
- base_color.hue = base_color.hue - hue_offset;
69
-
70
- if (sat_offset % 2 == 0)
71
- base_color.saturation = base_color.saturation + sat_offset
65
+ if opts[:color]
66
+ rgb = Color::RGB.from_html(opts[:color])
72
67
  else
73
- base_color.saturation = base_color.saturation - sat_offset
68
+ hue_offset = map(hex_val(14, 3), 0, 4095, 0, 359)
69
+ sat_offset = hex_val(17, 1)
70
+ base_color = Color::RGB.from_html(opts[:base_color]).to_hsl
71
+ base_color.hue = base_color.hue - hue_offset;
72
+
73
+ if (sat_offset % 2 == 0)
74
+ base_color.saturation = base_color.saturation + sat_offset
75
+ else
76
+ base_color.saturation = base_color.saturation - sat_offset
77
+ end
78
+ rgb = base_color.to_rgb
74
79
  end
75
- rgb = base_color.to_rgb
76
80
  r = (rgb.r * 255).round
77
81
  g = (rgb.g * 255).round
78
82
  b = (rgb.b * 255).round
@@ -1,3 +1,3 @@
1
1
  module GeoPattern
2
- VERSION = "1.1.4"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-25 00:00:00.000000000 Z
12
+ date: 2014-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: color