v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Template:C/doc

From Dwarf Fortress Wiki
< Template:C
Revision as of 15:37, 23 December 2009 by Hussell (talk | contribs) (Extra style in third parameter.)
Jump to navigation Jump to search

This template converts two case-insensitive hex digits into a style for the appropriate DF colors. The colors are:

0 Black #000000
1 Blue #000080
2 Green #008000
3 Cyan #008080
4 Red #800000
5 Magenta #800080
6 Brown #808000
7 Light Grey #c0c0c0
8 Dark Grey #808080
9 Light Blue #0000ff
A Light Green #00ff00
B Light Cyan #00ffff
C Light Red #ff0000
D Light Magenta #ff00ff
E Yellow #ffff00
F White #ffffff

For example, "{{c|f|3}}" produces "style=color:#fff;background-color:#008080", "{{c|7}}" produces "style=color:#c0c0c0;", and "{{c||D}}" produces "style=background-color:#f0f". Styles like this can be used in many places. In fact, this template was used to color the table rows above. "<span {{c|f|0}}>white text on a black background</span>" can be used to color small amounts of text, but the major use is in coloring tables, table rows, and table cells for ASCII diagrams.

Additional style can be added as a third parameter. E.g., "{{c|8|0|font-family: Courier New, monospace}}".