letter_avatar 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/letter_avatar/avatar.rb +6 -2
- data/lib/letter_avatar/colors.rb +5 -3
- data/lib/letter_avatar/version.rb +1 -1
- data/lib/letter_avatar.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6dacffd37b1ed6ffe0bd73e45b53e78633bad53c59ab6efd0aa130e468fde8c
|
4
|
+
data.tar.gz: 73a8007813254f22ab63d4c4146fd4ee864f7f3d391fc6d3b268112ad3f521b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a5a887dfcba06b5e1832127ca346ab8f95ff425dca8cb366c1dcab7bab967d3d47112c46f3ddc8c8915ea037a33d8bf96b80fd1163b2f4b69317d9e4c769b4
|
7
|
+
data.tar.gz: 4152a78ea6534e2391434a3923932e6548b59228ecf515e131220e1ea390ce20691122654310a634018a58f99d15b699321f8de900dcf25e651272753258f082
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ LetterAvatar.setup do |config|
|
|
54
54
|
config.colors_palette = :iwanthue # default is :google
|
55
55
|
config.weight = 500 # default is 300
|
56
56
|
config.annotate_position = '-0+10' # default is -0+5
|
57
|
-
|
57
|
+
config.letters_count = 2 # default is 1
|
58
58
|
config.pointsize = 70 # default is 140
|
59
59
|
end
|
60
60
|
```
|
data/lib/letter_avatar/avatar.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module LetterAvatar
|
2
4
|
class Avatar
|
3
5
|
# BUMP UP if avatar algorithm changes
|
@@ -41,9 +43,11 @@ module LetterAvatar
|
|
41
43
|
return filename if cache && File.exist?(filename)
|
42
44
|
|
43
45
|
fullsize = fullsize_path(identity)
|
44
|
-
|
45
|
-
|
46
|
+
if !cache || !File.exist?(fullsize)
|
47
|
+
generate_fullsize(identity)
|
48
|
+
end
|
46
49
|
LetterAvatar.resize(fullsize, filename, size, size) if size != FULLSIZE
|
50
|
+
|
47
51
|
filename
|
48
52
|
end
|
49
53
|
|
data/lib/letter_avatar/colors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
1
3
|
module LetterAvatar
|
2
4
|
module Colors
|
3
5
|
PALETTES = [:google, :iwanthue, :custom]
|
@@ -256,7 +258,7 @@ module LetterAvatar
|
|
256
258
|
|
257
259
|
def self.with_iwanthue(username)
|
258
260
|
iwanthue[
|
259
|
-
Digest::MD5.hexdigest(username)[0...15].to_i(16) % iwanthue.length
|
261
|
+
::Digest::MD5.hexdigest(username)[0...15].to_i(16) % iwanthue.length
|
260
262
|
]
|
261
263
|
end
|
262
264
|
|
@@ -270,13 +272,13 @@ module LetterAvatar
|
|
270
272
|
elsif /[\d]/ =~ char
|
271
273
|
google[char.to_i]
|
272
274
|
else
|
273
|
-
google[Digest::MD5.hexdigest(username)[0...15].to_i(16) % google.length]
|
275
|
+
google[::Digest::MD5.hexdigest(username)[0...15].to_i(16) % google.length]
|
274
276
|
end
|
275
277
|
end
|
276
278
|
|
277
279
|
def self.with_custom(username)
|
278
280
|
custom_palette = LetterAvatar.custom_palette
|
279
|
-
custom_palette[Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length]
|
281
|
+
custom_palette[::Digest::MD5.hexdigest(username)[0...15].to_i(16) % custom_palette.length]
|
280
282
|
end
|
281
283
|
|
282
284
|
def self.valid_custom_palette?(palette)
|
data/lib/letter_avatar.rb
CHANGED
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.9
|
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:
|
14
|
+
date: 2021-09-06 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: Gem for creating letter avatar from user's name
|
17
17
|
email:
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.1.3
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Create nice initals avatars from your users usernames
|