letter_avatar 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -0
- data/lib/letter_avatar/avatar.rb +3 -2
- data/lib/letter_avatar/configuration.rb +16 -0
- data/lib/letter_avatar/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa5863d77b3303b2c3c3e980f8a36c5b5be56a7e
|
4
|
+
data.tar.gz: 231c30256287ab8ba036ed2c5b572975709a4e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4a6faab9ef6f4573cea674c1be1b37ea7339c20689bcf53e96a6a2354071f19811de50a0566b13ee981dfe01f4293c8cc345e8c2c5f429edae7609c5ac87682
|
7
|
+
data.tar.gz: a8f4b56a920aa3a6df72aa1ee8693a2ea7f1006d60d6e0ab82c5238dbb871569dfa7c8a656baf674c952a30952b927935f7356aa083a15e26a8ee7ccb5ca3450
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@ Gem for creating letter avatar from user's name (or any other strong / character
|
|
4
4
|
|
5
5
|
Code extracted from [discourse](https://www.discourse.org/) source (thanks guys!) - I needed this functionality in three projects, so here's the gem! :-)
|
6
6
|
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/letter_avatar.svg)](https://badge.fury.io/rb/letter_avatar)
|
7
8
|
[![Code Climate](https://codeclimate.com/github/ksz2k/letter_avatar/badges/gpa.svg)](https://codeclimate.com/github/ksz2k/letter_avatar)
|
8
9
|
|
9
10
|
## Examples
|
@@ -53,6 +54,8 @@ LetterAvatar.setup do |config|
|
|
53
54
|
config.colors_palette = :iwanthue # default is :google
|
54
55
|
config.weight = 500 # default is 300
|
55
56
|
config.annotate_position = '-0+10' # default is -0+5
|
57
|
+
config.letters_count = 2 # default is 1
|
58
|
+
config.pointsize = 70 # default is 140
|
56
59
|
end
|
57
60
|
```
|
58
61
|
|
data/lib/letter_avatar/avatar.rb
CHANGED
@@ -18,7 +18,8 @@ module LetterAvatar
|
|
18
18
|
def self.from_username(username)
|
19
19
|
identity = new
|
20
20
|
identity.color = LetterAvatar::Colors.for(username)
|
21
|
-
|
21
|
+
letters = username.split(/\s+/).map {|word| word[0]}.join('')[0..LetterAvatar.letters_count - 1]
|
22
|
+
identity.letter = letters.upcase
|
22
23
|
|
23
24
|
identity
|
24
25
|
end
|
@@ -65,7 +66,7 @@ module LetterAvatar
|
|
65
66
|
convert
|
66
67
|
-size #{FULLSIZE}x#{FULLSIZE}
|
67
68
|
xc:#{to_rgb(identity.color)}
|
68
|
-
-pointsize
|
69
|
+
-pointsize #{LetterAvatar.pointsize}
|
69
70
|
-font #{FONT_FILENAME}
|
70
71
|
-weight #{LetterAvatar.weight}
|
71
72
|
-fill '#{LetterAvatar.fill_color}'
|
@@ -39,5 +39,21 @@ module LetterAvatar
|
|
39
39
|
def annotate_position=(v)
|
40
40
|
@annotate_position = v
|
41
41
|
end
|
42
|
+
|
43
|
+
def letters_count
|
44
|
+
@letters_count ||= 1
|
45
|
+
end
|
46
|
+
|
47
|
+
def letters_count=(v)
|
48
|
+
@letters_count = v
|
49
|
+
end
|
50
|
+
|
51
|
+
def pointsize
|
52
|
+
@pointsize ||= 140
|
53
|
+
end
|
54
|
+
|
55
|
+
def pointsize=(v)
|
56
|
+
@pointsize = v
|
57
|
+
end
|
42
58
|
end
|
43
59
|
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.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Developers
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: Gem for creating letter avatar from user's name
|
17
17
|
email:
|
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
52
|
rubyforge_project:
|
53
|
-
rubygems_version: 2.
|
53
|
+
rubygems_version: 2.6.10
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: Create nice initals avatars from your users usernames
|