octopal
beautiful POC
一个用于从图像中获取调色板的脚本。使用JavaScript和Canvas标签使其实现。
在线尝试:palette.junglestar.org
章鱼是一项基于:
查看演示|在Lokeshdhakar博客上阅读更多信息
var colorThief = new ColorThief ( ) ;
colorThief . getColor ( sourceImage ) ; getColor ( sourceImage [ , quality ] )
returns { r : num , g : num , b : num }在此示例中,我们构建了8个调色板。
var colorThief = new ColorThief ( ) ;
colorThief . getPalette ( sourceImage , 8 ) ; getPalette ( sourceImage [ , colorCount , quality ] )
returns [ [ num , num , num ] , [ num , num , num ] , ... ]npm install