Skip to content

Commit 99b6c81

Browse files
authored
refactor: Use font SVG attributes instead of CSS (DenverCoder1#356)
1 parent fa70ef0 commit 99b6c81

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/card.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,43 +284,43 @@ function generateCard(array $stats, array $params = null): string
284284
<g style='isolation: isolate'>
285285
<!-- Total Contributions Big Number -->
286286
<g transform='translate(1,48)'>
287-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideNums"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 700; font-size: 28px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 0.6s'>
287+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideNums"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='700' font-size='28px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 0.6s'>
288288
{$totalContributions}
289289
</text>
290290
</g>
291291
292292
<!-- Total Contributions Label -->
293293
<g transform='translate(1,84)'>
294-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 14px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 0.7s'>
294+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='14px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 0.7s'>
295295
{$totalContributionsText}
296296
</text>
297297
</g>
298298
299299
<!-- total contributions range -->
300300
<g transform='translate(1,114)'>
301-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 12px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 0.8s'>
301+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='12px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 0.8s'>
302302
{$totalContributionsRange}
303303
</text>
304304
</g>
305305
</g>
306306
<g style='isolation: isolate'>
307307
<!-- Current Streak Big Number -->
308308
<g transform='translate(166,48)'>
309-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["currStreakNum"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 700; font-size: 28px; font-style: normal; animation: currstreak 0.6s linear forwards'>
309+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["currStreakNum"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='700' font-size='28px' font-style='normal' style='animation: currstreak 0.6s linear forwards'>
310310
{$currentStreak}
311311
</text>
312312
</g>
313313
314314
<!-- Current Streak Label -->
315315
<g transform='translate(166,108)'>
316-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["currStreakLabel"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 700; font-size: 14px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 0.9s'>
316+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["currStreakLabel"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='700' font-size='14px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 0.9s'>
317317
{$currentStreakText}
318318
</text>
319319
</g>
320320
321321
<!-- Current Streak Range -->
322322
<g transform='translate(166,145)'>
323-
<text x='81.5' y='21' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 12px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 0.9s'>
323+
<text x='81.5' y='21' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='12px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 0.9s'>
324324
{$currentStreakRange}
325325
</text>
326326
</g>
@@ -339,21 +339,21 @@ function generateCard(array $stats, array $params = null): string
339339
<g style='isolation: isolate'>
340340
<!-- Longest Streak Big Number -->
341341
<g transform='translate(331,48)'>
342-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideNums"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 700; font-size: 28px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 1.2s'>
342+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideNums"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='700' font-size='28px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 1.2s'>
343343
{$longestStreak}
344344
</text>
345345
</g>
346346
347347
<!-- Longest Streak Label -->
348348
<g transform='translate(331,84)'>
349-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 14px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 1.3s'>
349+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='14px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 1.3s'>
350350
{$longestStreakText}
351351
</text>
352352
</g>
353353
354354
<!-- Longest Streak Range -->
355355
<g transform='translate(331,114)'>
356-
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 12px; font-style: normal; opacity: 0; animation: fadein 0.5s linear forwards 1.4s'>
356+
<text x='81.5' y='32' stroke-width='0' text-anchor='middle' fill='{$theme["dates"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='12px' font-style='normal' style='opacity: 0; animation: fadein 0.5s linear forwards 1.4s'>
357357
{$longestStreakRange}
358358
</text>
359359
</g>
@@ -399,7 +399,7 @@ function generateErrorCard(string $message, array $params = null): string
399399
<g style='isolation: isolate'>
400400
<!-- Error Label -->
401401
<g transform='translate(166,108)'>
402-
<text x='81.5' y='50' dy='0.25em' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' style='font-family: \"Segoe UI\", Ubuntu, sans-serif; font-weight: 400; font-size: 14px; font-style: normal'>
402+
<text x='81.5' y='50' dy='0.25em' stroke-width='0' text-anchor='middle' fill='{$theme["sideLabels"]}' stroke='none' font-family='\"Segoe UI\", Ubuntu, sans-serif' font-weight='400' font-size='14px' font-style='normal'>
403403
{$message}
404404
</text>
405405
</g>

tests/expected/test_card.svg

Lines changed: 9 additions & 9 deletions
Loading

tests/expected/test_error_card.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)