telegram-badge 1.2.1 → 1.2.3

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.
package/README.md CHANGED
@@ -246,12 +246,10 @@ npm run build
246
246
  - **ETH:** 0x286D65151b622dCC16624cEd8463FDa45585fd60
247
247
 
248
248
  <div align="center">
249
-
250
- <img src="public/btc.png" alt="BTC" style="height: 185px" />
251
- <img src="public/ton.png" alt="TON" style="height: 185px" />
252
- <img src="public/not.png" alt="NOT" style="height: 185px" />
249
+ <img src="public/btc.png" alt="BTC" style="height: 185px" /><br/>
250
+ <img src="public/ton.png" alt="TON" style="height: 185px" /><br/>
251
+ <img src="public/not.png" alt="NOT" style="height: 185px" /><br/>
253
252
  <img src="public/eth.png" alt="ETH" style="height: 185px" />
254
-
255
253
  </div>
256
254
 
257
255
  ## 📜 License
@@ -7,11 +7,11 @@ const TELEGRAM_LOGO = `<svg xmlns="http://www.w3.org/2000/svg" fill="white" view
7
7
  </svg>`;
8
8
  function generateBadgeSVG(format) {
9
9
  const { label, message, color, labelColor, style, logo } = format;
10
- const logoSpace = logo ? 25 : 0;
11
- // Better text width calculation
10
+ const logoSpace = logo ? 20 : 0;
11
+ // Better text width calculation with more spacing
12
12
  // Always add logoSpace to width calculation
13
13
  const labelWidth = label.length * 7 + 10 + logoSpace;
14
- const messageWidth = message.length * 7 + 10;
14
+ const messageWidth = message.length * 7 + 20;
15
15
  const totalWidth = labelWidth + messageWidth;
16
16
  // Create logo element
17
17
  const logoElement = logo ? `<image x="5" y="3" width="14" height="14" href="data:image/svg+xml;base64,${Buffer.from(TELEGRAM_LOGO).toString('base64')}"/>` : '';
@@ -26,8 +26,8 @@ function generateBadgeSVG(format) {
26
26
  </g>
27
27
  ${logoForBadge}
28
28
  <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="100">
29
- <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="175" transform="scale(.1)" fill="#fff" textLength="${label.length * 65}">${label.toUpperCase()}</text>
30
- <text x="${(labelWidth + messageWidth / 2) * 10}" y="175" font-weight="bold" transform="scale(.1)" fill="#fff" textLength="${message.length * 65}">${message.toUpperCase()}</text>
29
+ <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="175" transform="scale(.1)" fill="#fff" letter-spacing="1">${label.toUpperCase()}</text>
30
+ <text x="${(labelWidth + messageWidth / 2) * 10}" y="175" font-weight="bold" transform="scale(.1)" fill="#fff" letter-spacing="1">${message.toUpperCase()}</text>
31
31
  </g>
32
32
  </svg>`;
33
33
  }
@@ -41,8 +41,8 @@ function generateBadgeSVG(format) {
41
41
  </g>
42
42
  ${logoElement}
43
43
  <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
44
- <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${label.length * 65}">${label}</text>
45
- <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${message.length * 65}">${message}</text>
44
+ <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${label}</text>
45
+ <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${message}</text>
46
46
  </g>
47
47
  </svg>`;
48
48
  }
@@ -65,8 +65,8 @@ function generateBadgeSVG(format) {
65
65
  </g>
66
66
  ${socialLogoElement}
67
67
  <g fill="#333" text-anchor="middle" font-family="Helvetica,Arial,sans-serif" font-weight="700" font-size="110">
68
- <text x="${(labelWidth / 2 + 1 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${label.length * 65}">${label}</text>
69
- <text x="${(labelWidth + messageWidth / 2 + 2) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${message.length * 65}">${message}</text>
68
+ <text x="${(labelWidth / 2 + 1 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.6">${label}</text>
69
+ <text x="${(labelWidth + messageWidth / 2 + 2) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.6">${message}</text>
70
70
  </g>
71
71
  </svg>`;
72
72
  }
@@ -90,8 +90,8 @@ function generateBadgeSVG(format) {
90
90
  </g>
91
91
  ${logoElement}
92
92
  <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
93
- <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${label.length * 65}">${label}</text>
94
- <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${message.length * 65}">${message}</text>
93
+ <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${label}</text>
94
+ <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${message}</text>
95
95
  </g>
96
96
  </svg>`;
97
97
  }
@@ -112,10 +112,10 @@ function generateBadgeSVG(format) {
112
112
  </g>
113
113
  ${logoElement}
114
114
  <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
115
- <text aria-hidden="true" x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="${label.length * 65}">${label}</text>
116
- <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${label.length * 65}">${label}</text>
117
- <text aria-hidden="true" x="${(labelWidth + messageWidth / 2) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="${message.length * 65}">${message}</text>
118
- <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" textLength="${message.length * 65}">${message}</text>
115
+ <text aria-hidden="true" x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" letter-spacing="0.8">${label}</text>
116
+ <text x="${(labelWidth / 2 + (logo ? 7 : 0)) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${label}</text>
117
+ <text aria-hidden="true" x="${(labelWidth + messageWidth / 2) * 10}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" letter-spacing="0.8">${message}</text>
118
+ <text x="${(labelWidth + messageWidth / 2) * 10}" y="140" transform="scale(.1)" fill="#fff" letter-spacing="0.8">${message}</text>
119
119
  </g>
120
120
  </svg>`;
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-badge",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Generate Telegram group member count badges for GitHub README",
5
5
  "keywords": [
6
6
  "telegram",