Template:Color
- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1
or useTemplateData=only
on the /doc
subpage and transcluding it with {{Documentation}} into the template. <nowiki>
-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
Usage: {{Color|color|text}}
Examples:
- {{color|red|example text}} → example text
- {{color|#00F|example text}} → example text
- {{color|white|example text|bg=black}} → example text
- {{color|#000|box ''without'' tooltip|css=border:1px solid #7F7|title=}} → box without tooltip
Short forms:
- {{color||default color|bg=cyan}} → default color
- {{color|b|black color|bg=gold}} → black color
- {{color|w|white color|bg=purple}} → white color
To draw just a color box with bg-color, use it like
- {{Color||{{0|00}}|bg=#0a0}} → or {{Color|1=#F0F|2=XX|bg=#F0F}} → XX or the short form
{{Cbox|#CCC}}
→
To just tooltip a text, use it like
The <u>{{color|#000|underlined text|title=tooltip example}}</u> is ''{{W|tooltip}}ped'' : The underlined text is tooltipped.
It is also possible to define additional CSS data, e.g.
{{color|b|'''padded box'''|bg=#CFC|css=border:2px dotted #F80;padding:0 8px|title=CSS example}} → padded box
For colors see: Web colors. Three-digit hexadecimal color tables are shown there.
The bg-color is tooltipped — move the cursor to the field to see
The above documentation is transcluded from Template:Color/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |