How to add more color names to CSS 2.1 schema

You probably know that CSS 2 standard only defines 16 named colors. However, all popular modern browsers recognize namy more. Those names are technically in CSS 3, but if you wish, you can modify CSS schemas shipped in VS 2005 and VS 2005 and add more colors. Simplest way is to borrow color name definitions from IE6 CSS schema and include them in the CSS 2.x schema. You can find CSS schemas in Program Files\Microsoft Visual Studio 8\Common7\Packages\1033\schemas\CSS. Here are step by step instructions:

1. Go to C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\1033\schemas\CSS and make a backup copy of css21.xml (in a css21-backup.xml).

2. Open CSS21.xml in VS 2005 XML editor or Notepad.

3. Open CSS-IE6.xml in VS 2005 or Notepad.

4. Locate <cssmd:property-def _locID="color" ... /> block in CSS-IE6.xml. It is typically in the beginning of the file and contains definitions of colors like enum="AliceBlue AntiqueWhite ...". Select the element and copy it to clipboard.

5. Locate same element in CSS21.xml and replace it with the clipboard content.

6. Delete Windows-specific color definitions from the enumeration:

ActiveBorder ActiveCaption AppWorkspace Background ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightTxt InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLighShadow ThreeDShadow Window WindowFrame WindowText

7. Save CSS21.xml, close and restart Visual Studio.

You should now see all colors in intellisense and CSS validation will no longer be complaining that Goldenrod is an unknown color. Same steps apply to Visual Web Developer Express and VS 2008.