Generating a discrete color palette using cmap_*_discrete will interpolate colors from outside of a defined palette in cases where the number of colors used is less than the number of colors in the full palette. I think this is due to the use of grDevices::colorRampPalette as the palette function in colors_discrete.R. This interpolation is useful in cases where the number of colors needed is larger than the size of the palette or for continuous scales, but for cases where the number of colors needed is less we should expect that the palette function will simply pull from the palette in order, and not interpolate using grDevices::colorRampPalette. Below are the results of calling viz_palette on the "friday" palette for different values of num.

I'm unsure if this is intended behavior or not. @nmpeterson do you have any insight?
Generating a discrete color palette using
cmap_*_discretewill interpolate colors from outside of a defined palette in cases where the number of colors used is less than the number of colors in the full palette. I think this is due to the use ofgrDevices::colorRampPaletteas the palette function incolors_discrete.R. This interpolation is useful in cases where the number of colors needed is larger than the size of the palette or for continuous scales, but for cases where the number of colors needed is less we should expect that the palette function will simply pull from the palette in order, and not interpolate usinggrDevices::colorRampPalette. Below are the results of callingviz_paletteon the "friday" palette for different values ofnum.I'm unsure if this is intended behavior or not. @nmpeterson do you have any insight?