Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert a color to a hex string
ResourceFunction["ColorToHex"][color] converts color into an equivalent hex string. |
| {v} | gray level |
| {v,α} | gray level and α parameter |
| {r,g,b} | red, green, blue levels |
| {r,g,b,α} | RGB with α parameter |
Convert a color to a hex string:
| In[1]:= |
| Out[1]= |
Convert from RGB:
| In[2]:= |
| Out[2]= |
Convert from HSB:
| In[3]:= |
| Out[3]= |
Give explicit RGB values:
| In[4]:= |
| Out[4]= |
Apply to a list of colors:
| In[5]:= |
| Out[5]= |
| In[6]:= |
| Out[6]= |
Use a list of mixed color specifications:
| In[7]:= |
| Out[7]= |
When creating HTML content, hex strings can be used as color specifications:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
| In[11]:= |
| Out[11]= |
| Out[11]= | ![]() |
Pixel values are rounded to the nearest byte:
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= |
| In[14]:= |
| Out[14]= |
This work is licensed under a Creative Commons Attribution 4.0 International License