Source: https://www.stat.columbia.edu/~tzheng/files/Rcolor.pdf