php、gd、带有抗锯齿和阴影的颜色切换
我想制作一个带有颜色选择器的 WordPress 主题来切换主题的主要颜色。 在主题的某些点上,我想要更改的颜色可能是在图像中 - 也许当涉及到圆角、重叠的东西或任何其他在普通 CSS 中无法轻松完成的内容时。
我计划使用 GD 中的颜色切换功能来处理这些事情。然而,由于我基本上没有 GD 的经验,所以我首先想确定这些颜色切换功能是否可以处理阴影、抗锯齿等问题。我发现的例子都只是将一种纯色更改为另一种纯色。
有没有一个技巧可以用 GD 来做到这一点,如果有的话,你能给我一个教程或一个很好的例子的链接吗?
谢谢你!
I want to make a wordpress theme with a color picker to switch the main color(s) of the theme.
At some points of the theme the colors I want to change could be in images - maybe when it comes to rounded corners, overlapping stuff or anything else that couldn't be easily done in plain CSS.
I planned to take care of those things using a color switching function in GD. However, as I have basically no experience with GD I first wanted to make sure if those color switching functions can take care of shadows, antialiasing and stuff like that. The examples I found yet all just changed one plain color to another plain color.
Is there a trick to do that with GD and if yes, can you give me a link to a tutorial or a good example?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好将所有这些固定颜色抗锯齿图像替换为 .png 图像,并在需要与背景合并的任何位上设置适当的透明度。这样,您就只有一组主题图像,而不是每种颜色方案一组,这很快就会变得难以管理。
It'd be better to replace all those fixed-color-antialias images with .png images with appropriate transparency set on any bits that need to be merged with the background. That way you only have one set of images for the theme, instead of one-set-per-color-scheme, which could quickly get unmanageable.
大量的着色算法:
http://php.net/manual/en/function.imagefilter。 php
你还应该在谷歌搜索“php colorize”中找到一些不错的东西
Plenty of colorize algorithms:
http://php.net/manual/en/function.imagefilter.php
You should also find something nice in google searching for "php colorize"