Template:Color/doc: Difference between revisions
Jump to navigation
Jump to search
m (37 revisions) |
No edit summary |
||
Line 1: | Line 1: | ||
The quick '''[[Template:Color]]''' can be used to add a span of text with any given text color, such as an [[w:RGB color model|RGB]] hex code, #C9E72A, or any of the [[w:web colors|web colors]]: red, blue, green, moccasin, or darkorchid, etc. | |||
The quick '''[[Template:Color]]''' can be used to add a span of text with any given text color, such as an [[RGB color model|RGB]] hex code, #C9E72A, or any of the [[web colors]]: red, blue, green, moccasin, or darkorchid, etc | |||
=== Usage === | === Usage === | ||
Line 19: | Line 15: | ||
</pre> | </pre> | ||
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. | See: [[w:Web colors|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 === | === Performance considerations === | ||
The template merely uses a span tag: <code><span style="color:{{{1}}}">{{{2}}}</span></code>. It runs at speeds in excess of 700 per second, and so it is functionally identical to the longer span-tag markup. | The template merely uses a span tag: <code><span style="color:{{{1}}}">{{{2}}}</span></code>. It runs at speeds in excess of 700 per second, and so it is functionally identical to the longer span-tag markup. | ||
<includeonly> | <includeonly> | ||
[[Category:Formatting templates]] | |||
[[Category: | |||
</includeonly> | </includeonly> |
Revision as of 07:51, 8 June 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.
Usage
- {{color|name of color or hex code of color|Text}}
For example:
{{color|red|Hello, world!}} Template:Nsgives: Hello, world!
{{color|#00F000|Hello, world!}}Template:Nsgives: Hello, 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.