简体   繁体   English

CSS颜色叠加PNG

[英]CSS Color Overlay PNG

I thought that there would be an answer to this but I have not found one. 我认为会有一个答案,但我还没找到。

I have a PNG image with a transparent background. 我有一个透明背景的PNG图像。 Through CSS I'd like the image (not the transparent background) to change to a different color. 通过CSS,我想将图像(不是透明背景)更改为不同的颜色。

There should be a way to do this through web-kit... but I've heard that that way isn't supported... Is there another way to do it, if not how can I achieve this through web-kit? 应该有办法通过网络工具包来做到这一点...但我听说不支持这种方式......是否有其他方法可以做到这一点,如果不是我怎么能通过网络工具包实现这一目标?

For my example, is there a way to change the red ball to a different color... 对于我的例子,有没有办法将红球改成不同的颜色......

JSFIDDLE: http://jsfiddle.net/BkFBH/3/ JSFIDDLE: http//jsfiddle.net/BkFBH/3/

HTML: HTML:

<img id = "ball" src="http://www.clker.com/cliparts/p/0/L/e/j/B/red-circle-solid-md.png" width=100 height=100>

EDIT: I need to change in by HEX or RGBA, not hue! 编辑:我需要通过HEX或RGBA改变,而不是色调! But if there is a conversion from HEX to Hue or similar, that could also work! 但是如果从HEX到Hue或类似的转换,这也可以工作!

Thank you all! 谢谢你们! -Liam -利亚姆

You can use the hue-rotate CSS3 filter. 您可以使用hue-rotate CSS3过滤器。 Change the 120deg to your liking. 根据自己的喜好更改120deg

#ball {
    -webkit-filter: hue-rotate(120deg);
}

http://jsfiddle.net/BkFBH/4/ http://jsfiddle.net/BkFBH/4/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM