javascript - Output colours as table from console -
im using vibrant.js extract colours images in effort build palette. i've got script running , can see in console correct colours being generated, i'm not getting when try output them table … here's code.
var img = document.createelement('img'); img.setattribute('src', 'myimage.png') img.addeventlistener('load', function() { var vibrant = new vibrant(img); var swatches = vibrant.swatches() (var swatch in swatches) if (swatches.hasownproperty(swatch) && swatches[swatch]) console.log(swatch, swatches[swatch].gethex()) var output = '<table><tr><td style=\"background-color:#"'+ swatch +'";\"></td></tr></table>'; $('.palette').html(output); });
Comments
Post a Comment