Basic color algorithm code