Help me to convert color in php

by 1 replies
1
I have an problem with convert rgb or hex color to color name, i had try to search some function on google but all is wrong ...

Ex

myfunction (#f716a0) => it'll echo "Pink"

Does anyone know the best function to do this ?
Thanks for help
#website design #color #convert #php
  • You'll have to build your own lookup table relating standard hex values to named colors. You can find one here: CSS Color Names

    Then you'll have to have an rgb to hex converter, which you can find here:
    PHP Convert RGB from/to HTML hex color

    Be careful to pass values to your function using quotes to signify a string:
    myfunction('#aabbcc') {}

Next Topics on Trending Feed