@ijoshea
Anyway, It looks so interesting, So I tried something. I simply did monkey patching to get dominant color from MMM-GooglePhotos
’s image on load.

You can do your job with this code without modifying the source codes itselfs.
/* config/config.js */
{
module: "MMM-ModuleMonkeyPatch",
config: {
patches: [
{
module: "MMM-GooglePhotos",
method: "ready",
patch: async function (original, [ url, target ]) {
const ret = original(url, target)
let color = null
const process = async () => {
const { resolve, promise } = Promise.withResolvers()
const img = new Image()
img.crossOrigin = 'Anonymous'
img.src = 'https://corsproxy.io/?' + url
img.onload = () => {
const colorThief = new ColorThief()
const color = colorThief.getColor(img)
resolve(color)
}
return promise
}
if (typeof ColorThief === 'undefined') {
const loadScript = async (src) => {
const { resolve, promise } = Promise.withResolvers()
const script = document.createElement('script')
script.src = src
document.head.appendChild(script)
script.onload = () => resolve()
return promise
}
await loadScript('https://cdn.jsdelivr.net/npm/colorthief@2/dist/color-thief.min.js')
color = await process()
} else {
color = await process()
}
console.log(color) // It will show [R, G, B] array
// doYourJob(color)
return ret
},
},
],
},
},