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:
10
lib/logos.js
10
lib/logos.js
@@ -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
Reference in New Issue
Block a user