Question:
Where can I get the site's key colors or their logos? Are there similar services or write it yourself?
I imagine the essence of the API as follows: I give a link to the site, and I get the color of the site calculated from the first opaque pixel of the icon (and, if necessary, darkened / lightened by several tones) and, if possible, its logo.
I can’t calculate the color from the icon myself (due to cross-origin restrictions in JS), and collecting logos is a task for robots
Answer:
Try the service http://favicongrabber.com/service-api-reference , it has an API that supports client requests as well. The service returns a favicon for the site, for example:
fetch('http://favicongrabber.com/api/grab/github.com')
.then((res) => {
return res.json();
})
.then((data) => {
document.querySelector('#w').innerHTML = '<img src="' + data.icons[0].src + '" />';
});
Example: http://jsfiddle.net/maximzasorin/tk9dk4Lr/