Re: difference between two colors
- Posted by David Cuny <dcuny at LANSET.COM> Jun 07, 2001
- 369 views
Tone Skoda wrote: > Can anyone think of any better function > to get difference between two colors. The code in Dos32Lib does something similar to map the colors in a Euphoria bitmap to the best fit in the current palette. It seemed to work just fine with just comparing the difference of rgb. Essentially just a pared-down version of what you're proposing: best = #FFFFFF index = 0 -- examine each option for i = 1 to length options do -- get difference for each rgb for j = 1 to 3 diff += abs( color[j] - option[i][j] ) end for if diff < best then index = i best = diff end if end for -- David Cuny