C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Note: Here we see the HTML colors in a table generated using the C# language. Then we see the code that wrote the table.
HTML color table
activeborder
activecaption
activecaptiontext
aliceblue
antiquewhite
appworkspace
aqua
aquamarine
azure
beige
bisque
black
blanchedalmond
blue
blueviolet
brown
burlywood
buttonface
buttonhighlight
buttonshadow
cadetblue
chartreuse
chocolate
coral
cornflowerblue
cornsilk
crimson
cyan
darkblue
darkcyan
darkgoldenrod
darkgray
darkgreen
darkkhaki
darkmagenta
darkolivegreen
darkorange
darkorchid
darkred
darksalmon
darkseagreen
darkslateblue
darkslategray
darkturquoise
darkviolet
deeppink
deepskyblue
desktop
dimgray
dodgerblue
firebrick
floralwhite
forestgreen
fuchsia
gainsboro
ghostwhite
gold
goldenrod
gradientactivecaption
gradientinactivecaption
gray
graytext
green
greenyellow
highlight
highlighttext
honeydew
hotpink
hottrack
inactiveborder
inactivecaption
inactivecaptiontext
indianred
indigo
info
infotext
ivory
khaki
lavender
lavenderblush
lawngreen
lemonchiffon
lightblue
lightcoral
lightcyan
lightgoldenrodyellow
lightgray
lightgreen
lightpink
lightsalmon
lightseagreen
lightskyblue
lightslategray
lightsteelblue
lightyellow
lime
limegreen
linen
magenta
maroon
mediumaquamarine
mediumblue
mediumorchid
mediumpurple
mediumseagreen
mediumslateblue
mediumspringgreen
mediumturquoise
mediumvioletred
menu
menubar
menuhighlight
menutext
midnightblue
mintcream
mistyrose
moccasin
navajowhite
navy
oldlace
olive
olivedrab
orange
orangered
orchid
palegoldenrod
palegreen
paleturquoise
palevioletred
papayawhip
peachpuff
peru
pink
plum
powderblue
purple
red
rosybrown
royalblue
saddlebrown
salmon
sandybrown
scrollbar
seagreen
seashell
sienna
silver
skyblue
slateblue
slategray
snow
springgreen
steelblue
tan
teal
thistle
tomato
transparent
turquoise
violet
wheat
white
whitesmoke
window
windowframe
windowtext
yellow
yellowgreen
Tip: To compile the program, add the System.Drawing assembly to your project. When you execute it, all available colors will be printed to the Console.
And: It uses the StartsWith method and LINQ extension methods. These help generate the correct output.
StartsWith, EndsWithLINQC# program that generates HTML color table
using System;
using System.Drawing;
using System.Linq;
class Program
{
static void Main()
{
// Get enum strings and order them by name.
// Remove Control colors.
foreach (string c in Enum.GetNames(typeof(KnownColor)).Where(
item => !item.StartsWith("Control")).OrderBy(item => item))
{
// Write table row.
Console.WriteLine("<b style=background:{0}>{1}</b>",
c.ToLower(),
c.ToLower().PadRight(20));
}
}
}