【发布时间】:2020-04-07 22:57:03
【问题描述】:
我正在尝试更改 SVG 标记中 png 图像的颜色。我有透明类型的PNG。我需要根据用户选择的颜色自定义PNG中的颜色。因为有一些功能,您可以更改不同部分的颜色。那么如何做到这一点呢?有没有人可以帮助我?
<HoodieSvg
backgound="red"
width="800"
height="800">
<image href={lights} width="400" height="400" fill="#000"/>
<image href={model} width="400" height="400" />
<image href={shadows} width="400" height="400" />
</HoodieSvg>
import React from 'react'
const HoodieSvg = (props) => {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
>
{props.children}
</svg>
)
}
export default HoodieSvg
【问题讨论】:
-
怎么改?
-
我已更新声明...请查看@Paulie_D
-
这是不可能的。您无法更改图像部分的颜色。