Template:Color/doc: Difference between revisions
>Rusty.perrin (→DOE green: Add equivalent RGB code) |
>Izno (→Usage: add this to the doc page) |
||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} __NOTOC__ | ||
{{ | <!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> | ||
{{high-use}} | |||
{{Warning |'''Prose text intended for readers should never be manually colored.''' ([[MOS:PROSECOLOR]])}} | |||
{{Uses TemplateStyles|Template:Color/styles.css}} | |||
{{tl|color}} can be used to specify the foreground color of a span of text. Acceptable values are [[RGB color model|RGB]] hex codes, e.g. #C9E72A, or any of the [[web colors]]: red, blue, green, moccasin, darkorchid, etc. To set the background color of a span of text, use {{Template link|background color}}. | |||
== Usage == | == Usage == | ||
* {{Template link expanded|color|name of color or hex code of color|Text}} | |||
{{ | For example: | ||
* {{#invoke:demoTemplate|color|red|Hello, world!}} | |||
* {{#invoke:demoTemplate|color|#00F000|Hello, world!}} | |||
If the second parameter is omitted, the color value is displayed as text: | |||
* {{#invoke:demoTemplate|color|#00F000}} | |||
* {{#invoke:demoTemplate|color|red}} | |||
=== Dark mode === | |||
{{ | This template does not function in dark mode. If you have a use case for color in your page, you should use an existing more-specific template (such as {{tl|increase}} or {{tl|xt}}). | ||
== Redirects == | |||
* {{Template link general |COLOR|nolink=on|code=on}} | |||
* {{Template link general |Colored text|nolink=on|code=on}} | |||
* {{Template link general |Colour|nolink=on|code=on}} | |||
* {{Template link general|COLOUR|nolink=on|code=on}} | |||
* {{Template link general |Fgcolor|nolink=on|code=on}} | |||
== | == See also == | ||
* {{Template link|resize}} | |||
* {{Template link|colored link}} | |||
* {{Template link|background color}} | |||
* {{Template link|font color}} – allows setting both text and background color | |||
* {{Template link|coltit}} – colored table header cell | |||
* {{Template link|overcoloured}} – when color is used in a way that hides information from color-blind people | |||
== | == TemplateData == | ||
{{ | {{TemplateData header}} | ||
<templatedata> | |||
{ | |||
"description": "The color template can be used to add a span of text with any given text color", | |||
"params": { | |||
"1": { | |||
"label": "Color", | |||
"description": "CSS name of color or hex code of color, e.g. 'red' or '#00F000'.", | |||
"type": "string", | |||
"required": true | |||
}, | |||
"2": { | |||
"label": "Text", | |||
"description": "The string of text to be formatted in the desired color", | |||
"type": "string", | |||
"suggested": true | |||
} | |||
} | |||
} | |||
</templatedata> | |||
<includeonly>[[Category: | <includeonly>{{Sandbox other| | ||
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: --> | |||
[[Category:Text color templates| ]] | |||
}}</includeonly> |
Revision as of 10:35, 13 July 2024
This is a documentation subpage for Template:Color
(see that page for the template itself). It contains usage information, categories, and other content that is not part of the original template page. |
This template is used on approximately 497,000 pages, or roughly 5969% of all pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Prose text intended for readers should never be manually colored. (MOS:PROSECOLOR) |
Lua error in Module:TNT at line 159: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Uses TemplateStyles.tab. {{color}} can be used to specify the foreground color of a span of text. Acceptable values are RGB hex codes, e.g. #C9E72A, or any of the web colors: red, blue, green, moccasin, darkorchid, etc. To set the background color of a span of text, use {{background color}}.
Usage
{{color|name of color or hex code of color|Text}}
For example:
{{color|red|Hello, world!}}
→ Hello, world!{{color|#00F000|Hello, world!}}
→ Hello, world!
If the second parameter is omitted, the color value is displayed as text:
{{color|#00F000}}
→ #00F000{{color|red}}
→ red
Dark mode
This template does not function in dark mode. If you have a use case for color in your page, you should use an existing more-specific template (such as {{increase}} or {{xt}}).
Redirects
- Template:Template link general
- Template:Template link general
- Template:Template link general
- Template:Template link general
- Template:Template link general
See also
- {{resize}}
- {{colored link}}
- {{background color}}
- {{font color}} – allows setting both text and background color
- {{coltit}} – colored table header cell
- {{overcoloured}} – when color is used in a way that hides information from color-blind people
TemplateData
TemplateData for Color
The color template can be used to add a span of text with any given text color
Parameter | Description | Type | Status | |
---|---|---|---|---|
Color | 1 | CSS name of color or hex code of color, e.g. 'red' or '#00F000'. | String | required |
Text | 2 | The string of text to be formatted in the desired color | String | suggested |