I made a class that you can pass two hex colors and a percent(0 - 100) to see if color2 is with in the percent of color1.
Package com.gfxcomplex.utils
Class public class CompareColors
public methodsCompareColors[INDENT]CompareColors()
Creates a new Sprite instance.
check(color1:uint, color2:uint, margin:uint):Object
The check method requires three arguments, color1, color2 and the margin in which to use to compare the two colors.
Once the check method get it’s parameters it checks to see if color2 (“a hex value”) falls within color1’s (“hex value”) margin of difference.
[/INDENT]Example usage…
import com.gfxcomplex.utils;
var test:CompareColors = new CompareColors();
var outPut:Object = test(0xFFFFFF, 0x000000, 25);
trace(outPut.dis); //100
trace(outPut.check); //false
Example… http://gfxcomplex.com/labs/colorCheck.html
source for project.
http://gfxcomplex.com/labs/CompareColors.zip