Wiki: Fix Color Issues in Wiki Articles

Wiki: Fix Color Issues in Wiki Articles

Many Wiki articles use colors. Unfortunately, the way colors are often specified in
HTML, using RGB (Red, Green, Blue) values, is no longer supported in the TechNet Wiki. Until this situation is corrected, a workaround is to specify colors by color name in the HTML. This article helps implement this workaround. The issue has been discussed
in this forum thread:

In HTML colors can be specified as RGB values, three integers representing the amounts of red, green, and blue in the color. The integers range from 0 to 255. For example, the color red would be specified as rgb(255, 0, 0). Unfortunately, when a Wiki article
using RGB values is saved, most of the colors are often lost. The workaround is to replace the RGB values with color names. For example, replace this HTML:

<span style="color: rgb(255,0,0);">Example</span>

with this:

<span style="color: red;">Example</span>

Alternatively, colors can be specified with the "#" character followed by three hexadecimal bytes, each byte ranging from 00 to FF. There must be two characters for each byte. In this format, red is specified as #FF0000. This format is also no longer supported
and must be replaced by a standard color name.

The RGB system can specify over 3 million colors, but only 140 color names are recognized by the HTML and CSS color specification. This makes it difficult to select the best color name. The table below documents suggested color names to use in place of some
RGB values found in TechNet Wiki articles.

A script was developed to select the color name closest to each RGB value. The script considers the three RGB integers (or hexadecimal bytes) as coordinates in three dimensional space. For each standard color name, the script calculates the distance between
it and the RGB value. The color with the smallest distance is selected and documented in the table below. This was found to be much better than estimating by eye. The script has been posted in the TechNet Script Gallery here:

The first column of the table is the RGB value. The second column is the equivalent hexadecimal format for the color, such as #FF0000 for red. The third column is the color name that corresponds to these values. The last column shows the resulting color
as rendered in your browser.