fix: support logoColor to shield icons. (#8263)

* fix: support logoColor to shield icons.

* FIXUP: Use 'travis-ci' to 'travis'

* FIXUP: Update docs.

* docs tweak

Co-authored-by: chris48s <chris.shaw480@gmail.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Sébastien Règne
2022-11-26 14:48:34 +01:00
committed by GitHub
parent fe2b3dfff0
commit bcc39200ae
6 changed files with 85 additions and 29 deletions

View File

@@ -66,8 +66,12 @@ function getShieldsIcon({ name, color }) {
const { svg, base64, isMonochrome } = logos[name]
const svgColor = toSvgColor(color)
if (svgColor && isMonochrome) {
return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`))
if (svgColor) {
if (isMonochrome) {
return svg2base64(svg.replace(/fill="(.+?)"/g, `fill="${svgColor}"`))
} else {
return undefined
}
} else {
return base64
}
@@ -85,7 +89,7 @@ function getSimpleIconStyle({ icon, style }) {
}
function getSimpleIcon({ name, color, style }) {
const key = name.replace(/ /g, '-')
const key = name === 'travis' ? 'travis-ci' : name.replace(/ /g, '-')
if (!(key in simpleIcons)) {
return undefined

File diff suppressed because one or more lines are too long