Difference between revisions of "Template:Color/doc"

From blackwiki
Jump to navigation Jump to search
imported>Salix alba
(fix templatedata, uses positional not named parameters)
imported>Lfdder
Line 54: Line 54:
 
<includeonly>
 
<includeonly>
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Text color templates|{{PAGENAME}}]]
+
[[Category:Text color templates| ]]
  
 
</includeonly>
 
</includeonly>

Revision as of 11:17, 12 October 2013


The quick Template:Color can be used to add a span of text with any given text color, such as an RGB hex code, #C9E72A, or any of the web colors: red, blue, green, moccasin, or darkorchid, etc. The foreground text color is set, but to reset the background color, see: {{bg}}.

Usage

{{color|name of color or hex code of color|Text}}

For example:

{{color|red|Hello, world!}} Template:NsgivesHello, world!
{{color|#00F000|Hello, world!}}Template:NsgivesHello, world!

Wikitext generated:

<span style="color:{{{1|}}}">{{{2|}}}</span>

See: Web colors, for a list of colors. A misspelled color name will not be reported, but will cause the text to remain as black text.

Performance considerations

The template merely uses a span tag:  <span style="color:{{{1}}}">{{{2}}}</span>. It runs at speeds in excess of 700 per second, and so it is functionally identical to the longer span-tag markup.

Template data

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Color

The color template can be used to add a span of text with any given text color

Template parameters

ParameterDescriptionTypeStatus
Color1

CSS name of color or hex code of color, e.g. 'red' or '#00F000'.

Stringrequired
Text2

The string of text to be be formatted in the desired color

Stringrequired

See also