Package and source code available on cran: https://cran.r-project.org/package=colorspace..
The R colorspace package
The R colorspace package provides a set of pre-defined color palettes based on the Hue-Chroma-Luminance color space. The HCL color space, in contrast to the famous Red-Green-Blue color space, is based on the human color perception and allows to directly control the three major dimensions of how we perceive colors.
The R package provides a set of useful and handy tools and interactive interfaces to create, customize, and use effective color maps drawn from the HCL color space. Furthermore, a set of methods is included to simulate color vision deficiencies such as deuteranomaly (the “red-green” blindness), protanomaly (less common “blue-yellow” blindness) and the relatively rare tritanomaly to check if the color palette also work for our colleges with specific color constraints.