Template:Color/doc: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Undid revision 517628839 by 66.193.103.195 (talk))
(expanded description; aligned examples)
Line 3: Line 3:
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->


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


=== Usage ===
=== Usage ===


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


For example:
For example:


{{Tlx|color|red|Hello, world!}} results in {{color|red|Hello, world!}}<br />
{{Tlx|color|red|Hello, world!}} {{ns|8}}gives:&nbsp; {{color|red|Hello, world!}}<br />
{{Tlx|color|#00F000|Hello, world!}} results in {{color|#00F000|Hello, world!}}
{{Tlx|color|#00F000|Hello, world!}}{{ns}}gives:&nbsp; {{color|#00F000|Hello, world!}}


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


See [[Web colors]] for a list of colors.
See [[Web colors]] for a list of colors.
=== Performance considerations ===
The template merely uses a span tag:&nbsp; <code>&lt;span style="color:{{{1}}}">{{{2}}}&lt;/span></code>. It runs at speeds in excess of 700 per second, and so it is functionally identical to the longer span-tag markup.


=== See also ===
=== See also ===

Revision as of 18:38, 8 March 2013


The quick Template:Color can be used to add a span of text with any given color, such as an RBG hex code, #C9E72A, or any of the web colors: red, blue, green, mocassin, 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.

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.

See also