Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Sample colors from named color schemes
ResourceFunction["SampleColors"][k] gives k unique colors evenly sampled based on Hue. | |
ResourceFunction["SampleColors"][scheme,k] gives k colors evenly sampled from the named scheme. |
Get a list of n reasonably chosen colors:
| In[1]:= |
| Out[1]= | ![]() |
Sample colors from a named scheme (correcting for misspellings):
| In[2]:= |
| Out[2]= |
Make discrete palettes from random color gradients:
| In[3]:= |
| Out[3]= | ![]() |
Sample colors from the "Physical" collection:
| In[4]:= |
| Out[4]= | ![]() |
Sample colors from the "ThemeGradients" collection:
| In[5]:= |
| Out[5]= | ![]() |
To sample more colors than a scheme contains, use the option "Interpolation"→True:
| In[6]:= |
| Out[6]= |
| In[7]:= |
| Out[7]= |
For "Named" and "Indexed" color schemes, the "ColorList" property is not always sorted:
| In[8]:= |
| Out[8]= |
Note that for the finite "Indexed" color schemes there is a limit to the number of colors you can sample, unless you explicitly interpolate between them:
| In[9]:= |
| Out[9]= |
| In[10]:= |
| Out[10]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License