0

Working on a PHP project with a large product list. Each product has an image. I've taken the main colors off the image, but its let me with thousands of colours. I am trying to "match" the colors to the closest HTML standard colour.

Cannot find any documentation on this being accurate, any help would be brilliant...

I have tried multiple efforts to make this work, with little success. When i've had it running, its thrown too many anamolies, clueless, please help...

  • If you have a list of color codes you want to limit to, it seems pretty straight forward to find the closest match to a given number. Can you show what isn't working? Also, what's the use case for this? Surely modern browsers can just display whatever color code you want. – EdmCoff Dec 19 '22 at 16:13
  • The closest color you are looking for is the one with the smallest color distance. Color distance calculations can be found here: https://stackoverflow.com/questions/1633828/distance-between-colours-in-php – jspit Dec 19 '22 at 16:44
  • By "html color" are you talking about the ones defined by CSS? https://developer.mozilla.org/en-US/docs/Web/CSS/named-color – Chris Haas Dec 19 '22 at 18:21

0 Answers0