get color algorithm