png 文件上的颜色蒙版
我想为用户提出一种简单的方法来更改 png 文件的颜色(例如显示调色板并显示结果的实时预览)。
我的图形设计师向我发送了相同的 UI 元素,只是颜色发生了变化,那么我应该向他索取什么文件?像纯白色阴影的 png 之类的东西?
例如(图像并非 100% 相似,但您可以理解:一条浅线,然后是从浅到深的渐变,最后是一条暗线):
我更喜欢一个通用的 png,我可以在上面以编程方式应用蒙版或其他东西
I would like to propose a simple way for a user to change to color of a png file (for example showing a color palette and show a live preview of the result).
My graphic designer sends me the same UI elements with just the color changing, so what file should I ask from him ? Something like a white-shade only png ?
For example (the images are not 100% similar, but you get the idea : a light line followed by a gradient from lighter to darker, and lastly a dark line) :
I would prefer a generic png on which I could apply a mask or something programmatically
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要一个包含带有细节的 Alpha 通道的
.png
。“任何”彩色渐变的示例图像:
正如 Photoshop 中显示的那样:
以下是如何通过 HTML/CSS 使用图像的示例:
http://jsfiddle.net/wbk8d/
You want a
.png
containing an alpha channel with the detail.Example image for an "any" coloured gradient:
As it appears inside Photoshop:
And here's an example of how to use the image with HTML/CSS:
http://jsfiddle.net/wbk8d/
据我了解,您需要一种通用的方法来创建网站。在这种情况下,我建议您检查一下您的设计师是否能够在 HSL 范围内与您合作。如果没有的话,你可以自己点一下。这意味着,他提供了颜色和亮度。
查看此设计器,在 DotNet 中找到一种使用 HSL 方法更改任何图像的简单方法:
http://colorschemedesigner.com
As far as I understood, you need a generic way to create websites. In this case I recommend to check out if your designer is able to work with you in a HSL range. If not, you can dot it by yourself. That means, he privides Color and brightness.
Check out this designer to find a simple way in DotNet to change any image by using HSL methodes:
http://colorschemedesigner.com
也许你可以尝试 SVG 而不是 PNG。它是一种 xml 格式,您可以轻松地更改颜色。
Maybe you could try SVG instead of PNG. It is an xml format in which you may be able to easily change the color.