Change color of PNG image via CSS?

后端 未结 16 1408
自闭症患者
自闭症患者 2020-11-22 07:33

Given a transparent PNG displaying a simple shape in white, is it possible to somehow change the color of this through CSS? Some kind of overlay or what not?

16条回答
  •  臣服心动
    2020-11-22 07:47

    I found this great codepen example that you insert your hex color value and it returns the needed filter to apply this color to png

    CSS filter generator to convert from black to target hex color

    for example i needed my png to have the following color #1a9790

    then you have to apply the following filter to you png

    filter: invert(48%) sepia(13%) saturate(3207%) hue-rotate(130deg) brightness(95%) contrast(80%);
    

提交回复
热议问题