Jump to content

Making an is_color function


tibberous

Recommended Posts

I need a function that takes a color and returns true for false depending on whether or not it is a color.

 

I want it to support the following formats:

 

#000

#FFFFFF

rgb(255, 255, 255)

All the color names: http://www.javascripter.net/faq/colornam.htm#top

 

Basically it is three semi-easy regex expressions and a big array with an in array check. I was wondering if there was already one written, I Googled but couldn't find anything.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/70238-making-an-is_color-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.