Skip to content

Commit c32e4e1

Browse files
authored
fix: Transparent themes fire overlapping ring (#212)
1 parent e7e553e commit c32e4e1

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

src/card.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,15 @@ function generateCard(array $stats, array $params = null): string
137137
}
138138
</style>
139139
<defs>
140-
<clipPath id='_clipPath_OZGVUqgkTHHpPTYeqOmK3uLgktRVSwWw'>
140+
<clipPath id='outer_rectangle'>
141141
<rect width='495' height='195'/>
142142
</clipPath>
143+
<mask id='mask_out_ring_behind_fire'>
144+
<rect width='495' height='195' fill='white'/>
145+
<ellipse id='mask-ellipse' cx='247.5' cy='32' rx='13' ry='18' fill='black'/>
146+
</mask>
143147
</defs>
144-
<g clip-path='url(#_clipPath_OZGVUqgkTHHpPTYeqOmK3uLgktRVSwWw)'>
148+
<g clip-path='url(#outer_rectangle)'>
145149
<g style='isolation:isolate'>
146150
<path d='M 4.5 0 L 490.5 0 C 492.984 0 495 2.016 495 4.5 L 495 190.5 C 495 192.984 492.984 195 490.5 195 L 4.5 195 C 2.016 195 0 192.984 0 190.5 L 0 4.5 C 0 2.016 2.016 0 4.5 0 Z'
147151
style='stroke: {$theme["border"]}; fill: {$theme["background"]};stroke-miterlimit:10;rx: 4.5;'/>
@@ -201,8 +205,9 @@ function generateCard(array $stats, array $params = null): string
201205
</g>
202206
203207
<!-- ring around number -->
204-
<circle cx='247.5' cy='71' r='40' style='fill:none;stroke:{$theme["ring"]};stroke-width:5;opacity: 0; animation: fadein 0.5s linear forwards 0.4s;'></circle>
205-
<ellipse cx='247.5' cy='32' rx='13' ry='18' fill='{$theme["background"]}' stroke-opacity='0' />
208+
<g mask='url(#mask_out_ring_behind_fire)'>
209+
<circle cx='247.5' cy='71' r='40' style='fill:none;stroke:{$theme["ring"]};stroke-width:5;opacity: 0; animation: fadein 0.5s linear forwards 0.4s;'></circle>
210+
</g>
206211
<!-- fire icon -->
207212
<g style='opacity: 0; animation: fadein 0.5s linear forwards 0.6s; stroke-opacity: 0;'>
208213
<path d=' M 235.5 19.5 L 259.5 19.5 L 259.5 43.5 L 235.5 43.5 L 235.5 19.5 Z ' fill='none' stroke-opacity='0'/>
@@ -260,11 +265,11 @@ function generateErrorCard(string $message, array $params = null): string
260265
}
261266
</style>
262267
<defs>
263-
<clipPath id='_clipPath_OZGVUqgkTHHpPTYeqOmK3uLgktRVSwWw'>
268+
<clipPath id='outer_rectangle'>
264269
<rect width='495' height='195'/>
265270
</clipPath>
266271
</defs>
267-
<g clip-path='url(#_clipPath_OZGVUqgkTHHpPTYeqOmK3uLgktRVSwWw)'>
272+
<g clip-path='url(#outer_rectangle)'>
268273
<g style='isolation:isolate'>
269274
<path d='M 4.5 0 L 490.5 0 C 492.984 0 495 2.016 495 4.5 L 495 190.5 C 495 192.984 492.984 195 490.5 195 L 4.5 195 C 2.016 195 0 192.984 0 190.5 L 0 4.5 C 0 2.016 2.016 0 4.5 0 Z'
270275
style='stroke: {$theme["border"]}; fill: {$theme["background"]};stroke-miterlimit:10;rx: 4.5;'/>

tests/expected/test_card.svg

Lines changed: 9 additions & 4 deletions
Loading

tests/expected/test_date_card.svg

Lines changed: 9 additions & 4 deletions
Loading

tests/expected/test_error_card.svg

Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)