Commit cf00f6e54e1e24770957c345715610481aeb6e5e
Committed by
GitHub
1 parent
3720fe86
Exists in
master
letters_count, pointsize configurations utilized
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
lib/letter_avatar/avatar.rb
@@ -18,7 +18,8 @@ module LetterAvatar | @@ -18,7 +18,8 @@ module LetterAvatar | ||
18 | def self.from_username(username) | 18 | def self.from_username(username) |
19 | identity = new | 19 | identity = new |
20 | identity.color = LetterAvatar::Colors.for(username) | 20 | identity.color = LetterAvatar::Colors.for(username) |
21 | - identity.letter = username[0].upcase | 21 | + letters = username.split(/\s+/).map {|word| word[0]}.join('')[0..LetterAvatar.letters_count - 1] |
22 | + identity.letter = letters.upcase | ||
22 | 23 | ||
23 | identity | 24 | identity |
24 | end | 25 | end |
@@ -65,7 +66,7 @@ module LetterAvatar | @@ -65,7 +66,7 @@ module LetterAvatar | ||
65 | convert | 66 | convert |
66 | -size #{FULLSIZE}x#{FULLSIZE} | 67 | -size #{FULLSIZE}x#{FULLSIZE} |
67 | xc:#{to_rgb(identity.color)} | 68 | xc:#{to_rgb(identity.color)} |
68 | - -pointsize 140 | 69 | + -pointsize #{LetterAvatar.pointsize} |
69 | -font #{FONT_FILENAME} | 70 | -font #{FONT_FILENAME} |
70 | -weight #{LetterAvatar.weight} | 71 | -weight #{LetterAvatar.weight} |
71 | -fill '#{LetterAvatar.fill_color}' | 72 | -fill '#{LetterAvatar.fill_color}' |