letter_avatar 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bba34004fd9198351087e9bf2a684a11b4d6593c
4
- data.tar.gz: 95b0b43bb13237a9ec432bd54c3f785494bced46
3
+ metadata.gz: 8f99ca51c792e31c973755f7d47326c2ff5cac5b
4
+ data.tar.gz: b2e1bb4decc7c938bff9277fe46aa9eccc9e91d6
5
5
  SHA512:
6
- metadata.gz: 7c5f9c0ae4d685b60b1063b857b228c5116e48c6e2c3d7412a18f65f643845040ee2a3ae1ff58b2f69b43b038991762b1acd3450bb69a0b1f2e949ad77b447ab
7
- data.tar.gz: 2ddd0b96509c758bb027aaddf8f838c6ea6bc723d75a7a8559376ea6440ea31c0323ce1a7e3c332b5c5f1ef475d35d669a05aa63f951a9b34199b1ad80bdacf9
6
+ metadata.gz: e469b57b28152aab0989e45d7770a7096b74b0a2b815ae6c4adc73be69d5ce60df4eb60c7e33859bab23dc86026852920911626886aa88641d12e249663fe96d
7
+ data.tar.gz: e741c86d220eba607bf6f8dbade3fd36295de1753162c31af35e93a631e12f7879afa8ce543f79d7e41cbbe23c9aa7fa6b14fd344f982391749910848050ac52
data/README.md CHANGED
@@ -48,8 +48,10 @@ $ gem install letter_avatar
48
48
 
49
49
  ```ruby
50
50
  LetterAvatar.setup do |config|
51
- config.cache_base_path = 'public/system/lets' # default is 'public/system'
52
- config.colors_palette = :iwanthue # default is :google
51
+ config.cache_base_path = 'public/system/lets' # default is 'public/system'
52
+ config.colors_palette = :iwanthue # default is :google
53
+ config.weight = 500 # default is 300
54
+ config.annotate_position = '-0+10' # default is -0+5
53
55
  end
54
56
  ```
55
57
 
@@ -70,20 +70,18 @@ module LetterAvatar
70
70
 
71
71
  filename = fullsize_path(identity)
72
72
 
73
- commands = %W(
73
+ command = %W(
74
74
  convert
75
- -size 240x240
75
+ -size #{FULLSIZE}x#{FULLSIZE}
76
76
  xc:#{to_rgb(color)}
77
77
  -pointsize 140
78
78
  -font #{FONT_FILENAME}
79
- -weight 300
79
+ -weight #{LetterAvatar.weight}
80
80
  -fill '#{FILL_COLOR}'
81
81
  -gravity Center
82
- -annotate #{annotate_position} '#{letter}'
82
+ -annotate #{LetterAvatar.annotate_position} '#{letter}'
83
83
  '#{filename}'
84
- )
85
-
86
- command = commands.join(' ')
84
+ ).join(' ')
87
85
 
88
86
  pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)
89
87
  Process.waitpid(pid)
@@ -95,10 +93,6 @@ module LetterAvatar
95
93
  filename
96
94
  end
97
95
 
98
- def annotate_position
99
- LetterAvatar.colors_palette == :google ? '-0+5' : '-0+10'
100
- end
101
-
102
96
  def darken(color,pct)
103
97
  color.map do |n|
104
98
  (n.to_f * pct).to_i
@@ -1,3 +1,3 @@
1
1
  module LetterAvatar
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/letter_avatar.rb CHANGED
@@ -10,6 +10,12 @@ module LetterAvatar
10
10
  mattr_accessor :colors_palette
11
11
  @@colors_palette = :google
12
12
 
13
+ mattr_accessor :weight
14
+ @@weight = 300
15
+
16
+ mattr_accessor :annotate_position
17
+ @@annotate_position = '-0+5'
18
+
13
19
  def self.setup(&block)
14
20
  yield(self)
15
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - discourse developers