How to use svg names in ConTeXt?
This answer contains two alternative sources for the same colors (svg names). The files are formatted as modules and the easiest solution is to save one of those implementations as colo-imp-svg.mkiv
in your working directory and then use \usecolors [svg]
.
Alternative 1 (RGB, from official w3c site)
%D \module
%D [file=colo-imp-svg,
%D version=2018.09.17,
%D title=\CONTEXT\ Color Macros,
%D subtitle=SVG,
%D author=TeXnician]
%C
%D SVG named colors from https://www.w3.org/TR/SVG11/types.html#ColorKeywords
\startprotectedcolors
\definecolor [aliceblue] [r=0.941176, g=0.972549, b=1.000000]
\definecolor [antiquewhite] [r=0.980392, g=0.921569, b=0.843137]
\definecolor [aqua] [r=0.000000, g=1.000000, b=1.000000]
\definecolor [aquamarine] [r=0.498039, g=1.000000, b=0.831373]
\definecolor [azure] [r=0.941176, g=1.000000, b=1.000000]
\definecolor [beige] [r=0.960784, g=0.960784, b=0.862745]
\definecolor [bisque] [r=1.000000, g=0.894118, b=0.768627]
\definecolor [black] [r=0.000000, g=0.000000, b=0.000000]
\definecolor [blanchedalmond] [r=1.000000, g=0.921569, b=0.803922]
\definecolor [blue] [r=0.000000, g=0.000000, b=1.000000]
\definecolor [blueviolet] [r=0.541176, g=0.168627, b=0.886275]
\definecolor [brown] [r=0.647059, g=0.164706, b=0.164706]
\definecolor [burlywood] [r=0.870588, g=0.721569, b=0.529412]
\definecolor [cadetblue] [r=0.372549, g=0.619608, b=0.627451]
\definecolor [chartreuse] [r=0.498039, g=1.000000, b=0.000000]
\definecolor [chocolate] [r=0.823529, g=0.411765, b=0.117647]
\definecolor [coral] [r=1.000000, g=0.498039, b=0.313726]
\definecolor [cornflowerblue] [r=0.392157, g=0.584314, b=0.929412]
\definecolor [cornsilk] [r=1.000000, g=0.972549, b=0.862745]
\definecolor [crimson] [r=0.862745, g=0.078431, b=0.235294]
\definecolor [cyan] [r=0.000000, g=1.000000, b=1.000000]
\definecolor [darkblue] [r=0.000000, g=0.000000, b=0.545098]
\definecolor [darkcyan] [r=0.000000, g=0.545098, b=0.545098]
\definecolor [darkgoldenrod] [r=0.721569, g=0.525490, b=0.043137]
\definecolor [darkgray] [r=0.662745, g=0.662745, b=0.662745]
\definecolor [darkgreen] [r=0.000000, g=0.392157, b=0.000000]
\definecolor [darkgrey] [r=0.662745, g=0.662745, b=0.662745]
\definecolor [darkkhaki] [r=0.741176, g=0.717647, b=0.419608]
\definecolor [darkmagenta] [r=0.545098, g=0.000000, b=0.545098]
\definecolor [darkolivegreen] [r=0.333333, g=0.419608, b=0.184314]
\definecolor [darkorange] [r=1.000000, g=0.549020, b=0.000000]
\definecolor [darkorchid] [r=0.600000, g=0.196078, b=0.800000]
\definecolor [darkred] [r=0.545098, g=0.000000, b=0.000000]
\definecolor [darksalmon] [r=0.913725, g=0.588235, b=0.478431]
\definecolor [darkseagreen] [r=0.560784, g=0.737255, b=0.560784]
\definecolor [darkslateblue] [r=0.282353, g=0.239216, b=0.545098]
\definecolor [darkslategray] [r=0.184314, g=0.309804, b=0.309804]
\definecolor [darkslategrey] [r=0.184314, g=0.309804, b=0.309804]
\definecolor [darkturquoise] [r=0.000000, g=0.807843, b=0.819608]
\definecolor [darkviolet] [r=0.580392, g=0.000000, b=0.827451]
\definecolor [deeppink] [r=1.000000, g=0.078431, b=0.576471]
\definecolor [deepskyblue] [r=0.000000, g=0.749020, b=1.000000]
\definecolor [dimgray] [r=0.411765, g=0.411765, b=0.411765]
\definecolor [dimgrey] [r=0.411765, g=0.411765, b=0.411765]
\definecolor [dodgerblue] [r=0.117647, g=0.564706, b=1.000000]
\definecolor [firebrick] [r=0.698039, g=0.133333, b=0.133333]
\definecolor [floralwhite] [r=1.000000, g=0.980392, b=0.941176]
\definecolor [forestgreen] [r=0.133333, g=0.545098, b=0.133333]
\definecolor [fuchsia] [r=1.000000, g=0.000000, b=1.000000]
\definecolor [gainsboro] [r=0.862745, g=0.862745, b=0.862745]
\definecolor [ghostwhite] [r=0.972549, g=0.972549, b=1.000000]
\definecolor [gold] [r=1.000000, g=0.843137, b=0.000000]
\definecolor [goldenrod] [r=0.854902, g=0.647059, b=0.125490]
\definecolor [gray] [r=0.501961, g=0.501961, b=0.501961]
\definecolor [grey] [r=0.501961, g=0.501961, b=0.501961]
\definecolor [green] [r=0.000000, g=0.501961, b=0.000000]
\definecolor [greenyellow] [r=0.678431, g=1.000000, b=0.184314]
\definecolor [honeydew] [r=0.941176, g=1.000000, b=0.941176]
\definecolor [hotpink] [r=1.000000, g=0.411765, b=0.705882]
\definecolor [indianred] [r=0.803922, g=0.360784, b=0.360784]
\definecolor [indigo] [r=0.294118, g=0.000000, b=0.509804]
\definecolor [ivory] [r=1.000000, g=1.000000, b=0.941176]
\definecolor [khaki] [r=0.941176, g=0.901961, b=0.549020]
\definecolor [lavender] [r=0.901961, g=0.901961, b=0.980392]
\definecolor [lavenderblush] [r=1.000000, g=0.941176, b=0.960784]
\definecolor [lawngreen] [r=0.486275, g=0.988235, b=0.000000]
\definecolor [lemonchiffon] [r=1.000000, g=0.980392, b=0.803922]
\definecolor [lightblue] [r=0.678431, g=0.847059, b=0.901961]
\definecolor [lightcoral] [r=0.941176, g=0.501961, b=0.501961]
\definecolor [lightcyan] [r=0.878431, g=1.000000, b=1.000000]
\definecolor [lightgoldenrodyellow] [r=0.980392, g=0.980392, b=0.823529]
\definecolor [lightgray] [r=0.827451, g=0.827451, b=0.827451]
\definecolor [lightgreen] [r=0.564706, g=0.933333, b=0.564706]
\definecolor [lightgrey] [r=0.827451, g=0.827451, b=0.827451]
\definecolor [lightpink] [r=1.000000, g=0.713726, b=0.756863]
\definecolor [lightsalmon] [r=1.000000, g=0.627451, b=0.478431]
\definecolor [lightseagreen] [r=0.125490, g=0.698039, b=0.666667]
\definecolor [lightskyblue] [r=0.529412, g=0.807843, b=0.980392]
\definecolor [lightslategray] [r=0.466667, g=0.533333, b=0.600000]
\definecolor [lightslategrey] [r=0.466667, g=0.533333, b=0.600000]
\definecolor [lightsteelblue] [r=0.690196, g=0.768627, b=0.870588]
\definecolor [lightyellow] [r=1.000000, g=1.000000, b=0.878431]
\definecolor [lime] [r=0.000000, g=1.000000, b=0.000000]
\definecolor [limegreen] [r=0.196078, g=0.803922, b=0.196078]
\definecolor [linen] [r=0.980392, g=0.941176, b=0.901961]
\definecolor [magenta] [r=1.000000, g=0.000000, b=1.000000]
\definecolor [maroon] [r=0.501961, g=0.000000, b=0.000000]
\definecolor [mediumaquamarine] [r=0.400000, g=0.803922, b=0.666667]
\definecolor [mediumblue] [r=0.000000, g=0.000000, b=0.803922]
\definecolor [mediumorchid] [r=0.729412, g=0.333333, b=0.827451]
\definecolor [mediumpurple] [r=0.576471, g=0.439216, b=0.858824]
\definecolor [mediumseagreen] [r=0.235294, g=0.701961, b=0.443137]
\definecolor [mediumslateblue] [r=0.482353, g=0.407843, b=0.933333]
\definecolor [mediumspringgreen] [r=0.000000, g=0.980392, b=0.603922]
\definecolor [mediumturquoise] [r=0.282353, g=0.819608, b=0.800000]
\definecolor [mediumvioletred] [r=0.780392, g=0.082353, b=0.521569]
\definecolor [midnightblue] [r=0.098039, g=0.098039, b=0.439216]
\definecolor [mintcream] [r=0.960784, g=1.000000, b=0.980392]
\definecolor [mistyrose] [r=1.000000, g=0.894118, b=0.882353]
\definecolor [moccasin] [r=1.000000, g=0.894118, b=0.709804]
\definecolor [navajowhite] [r=1.000000, g=0.870588, b=0.678431]
\definecolor [navy] [r=0.000000, g=0.000000, b=0.501961]
\definecolor [oldlace] [r=0.992157, g=0.960784, b=0.901961]
\definecolor [olive] [r=0.501961, g=0.501961, b=0.000000]
\definecolor [olivedrab] [r=0.419608, g=0.556863, b=0.137255]
\definecolor [orange] [r=1.000000, g=0.647059, b=0.000000]
\definecolor [orangered] [r=1.000000, g=0.270588, b=0.000000]
\definecolor [orchid] [r=0.854902, g=0.439216, b=0.839216]
\definecolor [palegoldenrod] [r=0.933333, g=0.909804, b=0.666667]
\definecolor [palegreen] [r=0.596078, g=0.984314, b=0.596078]
\definecolor [paleturquoise] [r=0.686275, g=0.933333, b=0.933333]
\definecolor [palevioletred] [r=0.858824, g=0.439216, b=0.576471]
\definecolor [papayawhip] [r=1.000000, g=0.937255, b=0.835294]
\definecolor [peachpuff] [r=1.000000, g=0.854902, b=0.725490]
\definecolor [peru] [r=0.803922, g=0.521569, b=0.247059]
\definecolor [pink] [r=1.000000, g=0.752941, b=0.796078]
\definecolor [plum] [r=0.866667, g=0.627451, b=0.866667]
\definecolor [powderblue] [r=0.690196, g=0.878431, b=0.901961]
\definecolor [purple] [r=0.501961, g=0.000000, b=0.501961]
\definecolor [red] [r=1.000000, g=0.000000, b=0.000000]
\definecolor [rosybrown] [r=0.737255, g=0.560784, b=0.560784]
\definecolor [royalblue] [r=0.254902, g=0.411765, b=0.882353]
\definecolor [saddlebrown] [r=0.545098, g=0.270588, b=0.074510]
\definecolor [salmon] [r=0.980392, g=0.501961, b=0.447059]
\definecolor [sandybrown] [r=0.956863, g=0.643137, b=0.376471]
\definecolor [seagreen] [r=0.180392, g=0.545098, b=0.341176]
\definecolor [seashell] [r=1.000000, g=0.960784, b=0.933333]
\definecolor [sienna] [r=0.627451, g=0.321569, b=0.176471]
\definecolor [silver] [r=0.752941, g=0.752941, b=0.752941]
\definecolor [skyblue] [r=0.529412, g=0.807843, b=0.921569]
\definecolor [slateblue] [r=0.415686, g=0.352941, b=0.803922]
\definecolor [slategray] [r=0.439216, g=0.501961, b=0.564706]
\definecolor [slategrey] [r=0.439216, g=0.501961, b=0.564706]
\definecolor [snow] [r=1.000000, g=0.980392, b=0.980392]
\definecolor [springgreen] [r=0.000000, g=1.000000, b=0.498039]
\definecolor [steelblue] [r=0.274510, g=0.509804, b=0.705882]
\definecolor [tan] [r=0.823529, g=0.705882, b=0.549020]
\definecolor [teal] [r=0.000000, g=0.501961, b=0.501961]
\definecolor [thistle] [r=0.847059, g=0.749020, b=0.847059]
\definecolor [tomato] [r=1.000000, g=0.388235, b=0.278431]
\definecolor [turquoise] [r=0.250980, g=0.878431, b=0.815686]
\definecolor [violet] [r=0.933333, g=0.509804, b=0.933333]
\definecolor [wheat] [r=0.960784, g=0.870588, b=0.701961]
\definecolor [white] [r=1.000000, g=1.000000, b=1.000000]
\definecolor [whitesmoke] [r=0.960784, g=0.960784, b=0.960784]
\definecolor [yellow] [r=1.000000, g=1.000000, b=0.000000]
\definecolor [yellowgreen] [r=0.603922, g=0.803922, b=0.196078]
\stopprotectedcolors
\endinput
Alternative 2 (Hex, manually converted from w3c rgb)
%D \module
%D [file=colo-imp-svg,
%D version=2018.09.23,
%D title=\CONTEXT\ Color Macros,
%D subtitle=SVG,
%D author=TeXnician]
%C
%D SVG named colors from https://www.w3.org/TR/SVG11/types.html#ColorKeywords
%D manually converted to hex colors
\startprotectedcolors
\definecolor [aliceblue] [h=F0F8FF]
\definecolor [antiquewhite] [h=FAEBD7]
\definecolor [aqua] [h=00FFFF]
\definecolor [aquamarine] [h=7FFFD4]
\definecolor [azure] [h=F0FFFF]
\definecolor [beige] [h=F5F5DC]
\definecolor [bisque] [h=FFE4C4]
\definecolor [black] [h=000000]
\definecolor [blanchedalmond] [h=FFEBCD]
\definecolor [blue] [h=0000FF]
\definecolor [blueviolet] [h=8A2BE2]
\definecolor [brown] [h=A52A2A]
\definecolor [burlywood] [h=DEB887]
\definecolor [cadetblue] [h=5F9EA0]
\definecolor [chartreuse] [h=7FFF00]
\definecolor [chocolate] [h=D2691E]
\definecolor [coral] [h=FF7F50]
\definecolor [cornflowerblue] [h=6495ED]
\definecolor [cornsilk] [h=FFF8DC]
\definecolor [crimson] [h=DC143C]
\definecolor [cyan] [h=00FFFF]
\definecolor [darkblue] [h=00008B]
\definecolor [darkcyan] [h=008B8B]
\definecolor [darkgoldenrod] [h=B8860B]
\definecolor [darkgray] [h=A9A9A9]
\definecolor [darkgreen] [h=006400]
\definecolor [darkgrey] [h=A9A9A9]
\definecolor [darkkhaki] [h=BDB76B]
\definecolor [darkmagenta] [h=8B008B]
\definecolor [darkolivegreen] [h=556B2F]
\definecolor [darkorange] [h=FF8C00]
\definecolor [darkorchid] [h=9932CC]
\definecolor [darkred] [h=8B0000]
\definecolor [darksalmon] [h=E9967A]
\definecolor [darkseagreen] [h=8FBC8F]
\definecolor [darkslateblue] [h=483D8B]
\definecolor [darkslategray] [h=2F4F4F]
\definecolor [darkslategrey] [h=2F4F4F]
\definecolor [darkturquoise] [h=00CED1]
\definecolor [darkviolet] [h=9400D3]
\definecolor [deeppink] [h=FF1493]
\definecolor [deepskyblue] [h=00BFFF]
\definecolor [dimgray] [h=696969]
\definecolor [dimgrey] [h=696969]
\definecolor [dodgerblue] [h=1E90FF]
\definecolor [firebrick] [h=B22222]
\definecolor [floralwhite] [h=FFFAF0]
\definecolor [forestgreen] [h=228B22]
\definecolor [fuchsia] [h=FF00FF]
\definecolor [gainsboro] [h=DCDCDC]
\definecolor [ghostwhite] [h=F8F8FF]
\definecolor [gold] [h=FFD700]
\definecolor [goldenrod] [h=DAA520]
\definecolor [gray] [h=808080]
\definecolor [grey] [h=808080]
\definecolor [green] [h=008000]
\definecolor [greenyellow] [h=ADFF2F]
\definecolor [honeydew] [h=F0FFF0]
\definecolor [hotpink] [h=FF69B4]
\definecolor [indianred] [h=CD5C5C]
\definecolor [indigo] [h=4B0082]
\definecolor [ivory] [h=FFFFF0]
\definecolor [khaki] [h=F0E68C]
\definecolor [lavender] [h=E6E6FA]
\definecolor [lavenderblush] [h=FFF0F5]
\definecolor [lawngreen] [h=7CFC00]
\definecolor [lemonchiffon] [h=FFFACD]
\definecolor [lightblue] [h=ADD8E6]
\definecolor [lightcoral] [h=F08080]
\definecolor [lightcyan] [h=E0FFFF]
\definecolor [lightgoldenrodyellow] [h=FAFAD2]
\definecolor [lightgray] [h=D3D3D3]
\definecolor [lightgreen] [h=90EE90]
\definecolor [lightgrey] [h=D3D3D3]
\definecolor [lightpink] [h=FFB6C1]
\definecolor [lightsalmon] [h=FFA07A]
\definecolor [lightseagreen] [h=20B2AA]
\definecolor [lightskyblue] [h=87CEFA]
\definecolor [lightslategray] [h=778899]
\definecolor [lightslategrey] [h=778899]
\definecolor [lightsteelblue] [h=B0C4DE]
\definecolor [lightyellow] [h=FFFFE0]
\definecolor [lime] [h=00FF00]
\definecolor [limegreen] [h=32CD32]
\definecolor [linen] [h=FAF0E6]
\definecolor [magenta] [h=FF00FF]
\definecolor [maroon] [h=800000]
\definecolor [mediumaquamarine] [h=66CDAA]
\definecolor [mediumblue] [h=0000CD]
\definecolor [mediumorchid] [h=BA55D3]
\definecolor [mediumpurple] [h=9370DB]
\definecolor [mediumseagreen] [h=3CB371]
\definecolor [mediumslateblue] [h=7B68EE]
\definecolor [mediumspringgreen] [h=00FA9A]
\definecolor [mediumturquoise] [h=48D1CC]
\definecolor [mediumvioletred] [h=C71585]
\definecolor [midnightblue] [h=191970]
\definecolor [mintcream] [h=F5FFFA]
\definecolor [mistyrose] [h=FFE4E1]
\definecolor [moccasin] [h=FFE4B5]
\definecolor [navajowhite] [h=FFDEAD]
\definecolor [navy] [h=000080]
\definecolor [oldlace] [h=FDF5E6]
\definecolor [olive] [h=808000]
\definecolor [olivedrab] [h=6B8E23]
\definecolor [orange] [h=FFA500]
\definecolor [orangered] [h=FF4500]
\definecolor [orchid] [h=DA70D6]
\definecolor [palegoldenrod] [h=EEE8AA]
\definecolor [palegreen] [h=98FB98]
\definecolor [paleturquoise] [h=AFEEEE]
\definecolor [palevioletred] [h=DB7093]
\definecolor [papayawhip] [h=FFEFD5]
\definecolor [peachpuff] [h=FFDAB9]
\definecolor [peru] [h=CD853F]
\definecolor [pink] [h=FFC0CB]
\definecolor [plum] [h=DDA0DD]
\definecolor [powderblue] [h=B0E0E6]
\definecolor [purple] [h=800080]
\definecolor [red] [h=FF0000]
\definecolor [rosybrown] [h=BC8F8F]
\definecolor [royalblue] [h=4169E1]
\definecolor [saddlebrown] [h=8B4513]
\definecolor [salmon] [h=FA8072]
\definecolor [sandybrown] [h=F4A460]
\definecolor [seagreen] [h=2E8B57]
\definecolor [seashell] [h=FFF5EE]
\definecolor [sienna] [h=A0522D]
\definecolor [silver] [h=C0C0C0]
\definecolor [skyblue] [h=87CEEB]
\definecolor [slateblue] [h=6A5ACD]
\definecolor [slategray] [h=708090]
\definecolor [slategrey] [h=708090]
\definecolor [snow] [h=FFFAFA]
\definecolor [springgreen] [h=00FF7F]
\definecolor [steelblue] [h=4682B4]
\definecolor [tan] [h=D2B48C]
\definecolor [teal] [h=008080]
\definecolor [thistle] [h=D8BFD8]
\definecolor [tomato] [h=FF6347]
\definecolor [turquoise] [h=40E0D0]
\definecolor [violet] [h=EE82EE]
\definecolor [wheat] [h=F5DEB3]
\definecolor [white] [h=FFFFFF]
\definecolor [whitesmoke] [h=F5F5F5]
\definecolor [yellow] [h=FFFF00]
\definecolor [yellowgreen] [h=9ACD32]
\stopprotectedcolors
\endinput
These colors are available in ConTeXt under the color scheme xwi
for (X-Windows). The note above the file says
%D I've forgotten where I got these definitions from, but maybe
%D they can be of use.
So, you can use
\usecolors [xwi]
\starttext
\color[lavenderblush]{Text}
\stoptext
Note that for MkIV, you don't need to include the line \setupcolors[state=start]
because colors are enabled by default.
A very similar color scheme is available as x11
. The source says that these colors are taken from /usr/share/X11/rgb.txt
.
Another color scheme with svg colors is ema
which contains "Emacs" colors from /emacs/etc/rgb.txt
. This even contains a few variants of lavenderblush