Comparing RGB values..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarkoKlacar
    Recognized Expert Contributor
    • Aug 2007
    • 296

    Comparing RGB values..

    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:
    Code:
    $BaseColor = BLACK
    $ColorOne = YELLOW
    $ColorTwo = DARKGREY
    What I need is a way to compare the colors so that it returns DARKGREY.

    Hope it makes sence.

    Thanks in advance
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    hi,
    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.

    Comment

    • MarkoKlacar
      Recognized Expert Contributor
      • Aug 2007
      • 296

      #3
      Hi,

      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

      Comment

      Working...