added boundaries check to colors