color-thief icon indicating copy to clipboard operation
color-thief copied to clipboard

Support for style="background-image: url('.....')

Open mediabuff opened this issue 3 years ago • 1 comments

Hi all, does this scenario work ? Does it only work on img tag ?

mediabuff avatar Apr 12 '23 22:04 mediabuff

Just create an img and set the src. Something like:

    const img = document.createElement('img');
    img.src = document.querySelector(querySelector).style.backgroundImage.match(/"(.*?)"/)[1];

artrz avatar May 13 '24 20:05 artrz