Hi Amir,
why you are working with pattern matching?
I think in your case it would be better to work in HSL (hue - saturation - luminance).
Extract from your picture the saturation and hue and apply them in a XY graph (x: hue and y saturation).
In most cases hue and saturation is enough, otherwise you can take hue and luminance (try it out which combination is the best one in your case)
With the help of the diagram you can fix iempirically the areas for the LED colors.
The advantage is, that you have far less problems by change of the surroundings light.
Regards,
ThSa