Template:Color/doc: Difference between revisions
→Usage: add this to the doc page
>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> |