letter_avatar 0.1.6 → 0.1.7
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 +4 -4
- data/README.md +4 -2
- data/lib/letter_avatar/avatar.rb +5 -11
- data/lib/letter_avatar/version.rb +1 -1
- data/lib/letter_avatar.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f99ca51c792e31c973755f7d47326c2ff5cac5b
|
4
|
+
data.tar.gz: b2e1bb4decc7c938bff9277fe46aa9eccc9e91d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
52
|
-
config.colors_palette
|
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
|
|
data/lib/letter_avatar/avatar.rb
CHANGED
@@ -70,20 +70,18 @@ module LetterAvatar
|
|
70
70
|
|
71
71
|
filename = fullsize_path(identity)
|
72
72
|
|
73
|
-
|
73
|
+
command = %W(
|
74
74
|
convert
|
75
|
-
-size
|
75
|
+
-size #{FULLSIZE}x#{FULLSIZE}
|
76
76
|
xc:#{to_rgb(color)}
|
77
77
|
-pointsize 140
|
78
78
|
-font #{FONT_FILENAME}
|
79
|
-
-weight
|
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
|
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
|