change colour algorithm