@@ -142,6 +142,9 @@ function generateCard(array $stats, array $params = null): string
142142 // number formatter
143143 $ numFormatter = new NumberFormatter ($ localeCode , NumberFormatter::DECIMAL );
144144
145+ // read border_radius parameter, default to 4.5 if not set
146+ $ borderRadius = $ params ["border_radius " ] ?? "4.5 " ;
147+
145148 // total contributions
146149 $ totalContributions = $ numFormatter ->format ($ stats ["totalContributions " ]);
147150 $ firstContribution = formatDate ($ stats ["firstContribution " ], $ dateFormat , $ localeCode );
@@ -179,7 +182,7 @@ function generateCard(array $stats, array $params = null): string
179182 </style>
180183 <defs>
181184 <clipPath id='outer_rectangle'>
182- <rect width='495' height='195'/>
185+ <rect width='495' height='195' rx=' { $ borderRadius } ' />
183186 </clipPath>
184187 <mask id='mask_out_ring_behind_fire'>
185188 <rect width='495' height='195' fill='white'/>
@@ -188,8 +191,7 @@ function generateCard(array $stats, array $params = null): string
188191 </defs>
189192 <g clip-path='url(#outer_rectangle)'>
190193 <g style='isolation:isolate'>
191- <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'
192- style='stroke: {$ theme ["border " ]}; fill: {$ theme ["background " ]};stroke-miterlimit:10;rx: 4.5;'/>
194+ <rect stroke=' {$ theme ["border " ]}' fill=' {$ theme ["background " ]}' rx=' {$ borderRadius }' x='0.5' y='0.5' width='494' height='194'/>
193195 </g>
194196 <g style='isolation:isolate'>
195197 <line x1='330' y1='28' x2='330' y2='170' vector-effect='non-scaling-stroke' stroke-width='1' stroke=' {$ theme ["stroke " ]}' stroke-linejoin='miter' stroke-linecap='square' stroke-miterlimit='3'/>
@@ -301,6 +303,9 @@ function generateErrorCard(string $message, array $params = null): string
301303 // get requested theme, use $_REQUEST if no params array specified
302304 $ theme = getRequestedTheme ($ params );
303305
306+ // read border_radius parameter, default to 4.5 if not set
307+ $ borderRadius = $ params ["border_radius " ] ?? "4.5 " ;
308+
304309 return "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='isolation:isolate' viewBox='0 0 495 195' width='495px' height='195px'>
305310 <style>
306311 a {
@@ -309,13 +314,12 @@ function generateErrorCard(string $message, array $params = null): string
309314 </style>
310315 <defs>
311316 <clipPath id='outer_rectangle'>
312- <rect width='495' height='195'/>
317+ <rect width='495' height='195' rx=' { $ borderRadius } ' />
313318 </clipPath>
314319 </defs>
315320 <g clip-path='url(#outer_rectangle)'>
316321 <g style='isolation:isolate'>
317- <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'
318- style='stroke: {$ theme ["border " ]}; fill: {$ theme ["background " ]};stroke-miterlimit:10;rx: 4.5;'/>
322+ <rect stroke=' {$ theme ["border " ]}' fill=' {$ theme ["background " ]}' rx=' {$ borderRadius }' x='0.5' y='0.5' width='494' height='194'/>
319323 </g>
320324 <g style='isolation:isolate'>
321325 <!-- Error Label -->
@@ -329,8 +333,8 @@ function generateErrorCard(string $message, array $params = null): string
329333 <!-- mask for background behind face -->
330334 <defs>
331335 <mask id='cut-off-area'>
332- <rect x='0' y='0' width='500' height='500' fill='white' />
333- <ellipse cx='247.5' cy='31' rx='13' ry='18'/>
336+ <rect x='0' y='0' width='500' height='500' fill='white' />
337+ <ellipse cx='247.5' cy='31' rx='13' ry='18'/>
334338 </mask>
335339 </defs>
336340 <!-- Sad face -->
@@ -362,7 +366,7 @@ function convertSvgToPng(string $svg): string
362366 $ svg = preg_replace ("/(<style>\X*?<\/style>)/m " , "" , $ svg );
363367 $ svg = preg_replace ("/(opacity: 0;)/m " , "opacity: 1; " , $ svg );
364368 $ svg = preg_replace ("/(animation: fadein.*?;)/m " , "opacity: 1; " , $ svg );
365- $ svg = preg_replace ("/(animation: currentstreak .*?;)/m " , "font-size: 28px; " , $ svg );
369+ $ svg = preg_replace ("/(animation: currstreak .*?;)/m " , "font-size: 28px; " , $ svg );
366370 $ svg = preg_replace ("/<a \X*?>(\X*?)<\/a>/m " , '\1 ' , $ svg );
367371
368372 // save svg to random file
0 commit comments