Returns a function of n that gives the first n colours of a palette.
This is the form ggplot2's ggplot2::discrete_scale() and a number of other
packages expect, and is what the japanesecolors scales use internally.
Details
The palettes are curated categorical sets, so the returned function never interpolates or recycles: asking for more colours than the palette holds is an error rather than a silently repeated or blended colour.