Jump to content

Wikipedia:WikiProject C/C++/Syntax highlighting

From Wikipedia, the free encyclopedia

It would be nice to make full use of HTML's facility with text formatting in code samples. Following are proposals for syntax highlighting.

Standard colors

[edit]

While the usual white or off-white background is reasonably well suited for plain encyclopedic text, it's poor at providing the contrast needed to easily distinguish color. Thus, colored text should preferably be placed on a dark background to allow a broad range of colors to be used. Note, however, that pure blue is less visible against black than against white.

The default colors are proposed to be as follows (it will of course be possible to override them with style sheets):

Color RGB triplet Uses
White #ffffff keywords
Red #ff0000 decimal numbers
Orange #ff8000 octal numbers
Yellow #ffff00 characters, strings
Green #00ff00 preprocessor symbols
Cyan #00ffff function names
Blue #0000ff ?
Magenta #ff00ff hexadecimal numbers
Dark red #a00000 ?
Dark orange #a05000 ?
Dark yellow #a0a000 comments
Dark green #00a000 ?
Dark cyan #00a0a0 punctuation
Dark blue #0000a0 ?
Dark magenta #a000a0 ?
Gray #cccccc everything else
Dark gray #a0a0a0 ?