1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00

fix auto-sized logo sizes (#10764)

This commit is contained in:
LitoMore 2024-12-30 01:04:24 +08:00 committed by GitHub
parent e6b66a8865
commit 00c73c872d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,10 +93,13 @@ function getSimpleIcon({ name, color, style, size }) {
if (size === 'auto') {
const { width: iconWidth, height: iconHeight } = getIconSize(key)
if (iconWidth > iconHeight) {
if (iconWidth !== iconHeight) {
const path = resetIconPosition(simpleIcons[key].path)
iconSvg = iconSvg
.replace('viewBox="0 0 24 24"', `viewBox="0 0 24 ${iconHeight}"`)
.replace(
'viewBox="0 0 24 24"',
`viewBox="0 0 ${iconWidth} ${iconHeight}"`,
)
.replace(/<path d=".*"\/>/, `<path d="${path}"/>`)
}
}