Wikipedia:WikiProject C/C++/Syntax highlighting
(Redirected from Wikipedia:WikiProject C/Syntax highlighting)
This page is currently inactive and is retained for historical reference. Either the page is no longer relevant or consensus on its purpose has become unclear. To revive discussion, seek broader input via a forum such as the village pump. |
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
editWhile 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 | ? |