Template:Color

From Gentoo Wiki
Jump to: navigation, search
[edit

Documentation

Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages.

As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.

This template provides a convenient way to produce colored text in simple cases. Note that if the text is to be displayed as <code> or in some other HTML-style element, it may be preferable (or even necessary) to incorporate a style="color:…" attribute directly into the opening tag of the containing element, instead of using this template.

Parameters

Parameter name Required? Default value Description
Anonymous parameter 1 Yes #000 Color to use; this must be a legal CSS color name or code.
Anonymous parameter 2 Yes (n/a) Text to be colored.

Usage

See the template's testcases:

Correct

Two anonymous parameters, the color and the text to be colored
Wiki code
{{Color|green|everything's fine}}
Main version
everything's fine
Sandbox version


Empty first anonymous parameter (uses the default color, black)
Wiki code
{{Color||OK, but useless}}
Main version
OK, but useless
Sandbox version


Incorrect

No parameter (error message)
Wiki code
{{Color}}
Main version
{{Color template error}}
Parameter 1 not defined. For correct usage see Color template's documentation on the 1 parameter.
Sandbox version


One anonymous parameter (colored error message)
Wiki code
{{Color|green}}
Main version
{{Color template error}}
Parameter 1 not defined. For correct usage see Color template's documentation on the 1 parameter.
Sandbox version
Note
The above documentation is transcluded from Template:Color/doc. (edit | history)
Editors can experiment in this template's sandbox (edit) and testcases (edit) pages.
Please add categories and interwikis to the /doc subpage. (See the subpages of this template.)