added dection of white and black color (black does not work properly)