考虑一个带有两个部分重叠的圆圈的 SVG,两者都带有fill="currentColor"
. 我不控制当前颜色的值,它可以通过我无法控制的代码设置为任何值。
我希望整个图形具有相同的纯色。如果图像碰巧有例如color: red
. 但是,当当前颜色具有 Alpha 通道时,圆圈重叠的部分会变暗。
我想避免这种情况。基本上,我想让第一个图像看起来像这个例子中的第二个:
<svg viewBox="0 0 10 10" style="color: rgba(0,0,0,50%); width: 100px;">
<circle cx="3" cy="5" r="3" fill="currentColor"></circle>
<circle cx="7" cy="5" r="3" fill="currentColor"></circle>
</svg>
<svg viewBox="0 0 10 10" style="color: rgb(50%,50%,50%); width: 100px;">
<circle cx="3" cy="5" r="3" fill="currentColor"></circle>
<circle cx="7" cy="5" r="3" fill="currentColor"></circle>
</svg>
这是否可以实现,也许使用混合模式?