I am now doing a page, the background picture is randomly obtained from a picture library, some colors are darker, some colors are lighter, I want to use js to automatically judge, when the picture color is dark, set the font color to white, when the picture color is light, set it to black.
just as the color of the iOS lock screen automatically changes according to the color of the wallpaper.
how can I judge the color of a picture?