supertramp 0.6.1 → 0.7.0
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/lib/supertramp/avatar.rb +6 -0
- data/lib/supertramp/version.rb +1 -1
- data/lib/templates/avatar.svg.erb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6207da41ee6c3835ff5280521e790f0c3b955d4f0296402a803442713c1939a7
|
4
|
+
data.tar.gz: 81374ecd348906a1d35db38230044b13f579c3799674b8ba27de551d8f9b5d3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 138b06a3970592c84e58af553a74c9048e25bf76f8940892e0b307b8ff5fb8bcc1707a36085f091cd734a0c498a80690a0aafa02f4fa07ff2b58879076a1b80b
|
7
|
+
data.tar.gz: 19a473b418f266ec8946d164b5651866d1c2244f9ba979ff2f2bcd3bc08a35f75be8c289fa1e96fc3af632696c6248a9e8ca6a166bdd52e9322e2a283b1818b7
|
data/lib/supertramp/avatar.rb
CHANGED
@@ -24,6 +24,12 @@ class Supertramp
|
|
24
24
|
bind_template("_#{@shape}")
|
25
25
|
end
|
26
26
|
|
27
|
+
# Scale the text size proportinaly based on the number of initials
|
28
|
+
# to ensure they all fit, with a max size of 26
|
29
|
+
def text_size
|
30
|
+
[(51.0 / @initials.chars.count).ceil, 26].min
|
31
|
+
end
|
32
|
+
|
27
33
|
private
|
28
34
|
|
29
35
|
def bind_template(file)
|
data/lib/supertramp/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50">
|
3
3
|
<%= shape %>
|
4
|
-
<text fill="#fff" font-family="Helvetica,Arial,sans-serif" font-size="
|
4
|
+
<text fill="#fff" font-family="Helvetica,Arial,sans-serif" font-size="<%= text_size %>" font-weight="500" x="50%" y="55%" dominant-baseline="middle" text-anchor="middle">
|
5
5
|
<%= @initials %>
|
6
6
|
</text>
|
7
7
|
</svg>
|