By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

Comparing RGB values..

Expert 100+
P: 296
Does anyone know a good script for comparing RBG values?
The values are hexadecimal and I need to find a color that is closest to the one I'm comparing. I've tried a lot of stuff but I can't get the results I want.

Picture this:
Expand|Select|Wrap|Line Numbers
  1. $BaseColor = BLACK
  2. $ColorOne = YELLOW
  3. $ColorTwo = DARKGREY
What I need is a way to compare the colors so that it returns DARKGREY.

Hope it makes sence.

Thanks in advance
Feb 11 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 490
play with hexdec("333333").
It returns the decimal value for a hex number.

Pass the three in to a function and then compare them. its alot easier to compare denary the hexidecimal.
Feb 11 '08 #2

Expert 100+
P: 296

I've already played around with that one, no success...
It sounds so easy but than it just won't work as I should...

Thanks anyway
Feb 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.