javascript 根据图像主色更改背景颜色?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15999909/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 02:53:10  来源:igfitidea点击:

Change color of background based on image main color?

javascriptjquerycssitunesbackground-color

提问by user2279722

I don't know if this isactually possible but it would be nice if it is! Taaking inspiration from the new iTunes where the background color seems to be set via the (major) color of the artwork image. I'm looking to do something similar with javascript/cs maybe using jQuery, essentially changing the background-color of a div based on an image inside it.

我不知道这是否真的可行,但如果可行就太好了!从新的 iTunes 中获得灵感,其中背景颜色似乎是通过艺术品图像的(主要)颜色设置的。我希望用 javascript/cs 做一些类似的事情,也许使用 jQuery,基本上是根据里面的图像改变 div 的背景颜色。

回答by ndrizza