Template:Color/doc: Difference between revisions

From USApedia
>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__
{{tc}}
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
The [[Template:Color|Color template]] can be used to add a span of text with a given color.
{{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}}


{{Tlx|color|name of color or hex code of color|Text}}
For example:
* {{#invoke:demoTemplate|color|red|Hello, world!}}
* {{#invoke:demoTemplate|color|#00F000|Hello, world!}}


For example:
If the second parameter is omitted, the color value is displayed as text:
* {{#invoke:demoTemplate|color|#00F000}}
* {{#invoke:demoTemplate|color|red}}


{{Tlx|color|red|Hello, world!}} results in {{color|red|Hello, world!}}<br />
=== Dark mode ===
{{Tlx|color|#00F000|Hello, world!}} results in {{color|#00F000|Hello, world!}}
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}}).


View a list of available [http://en.wikipedia.org/wiki/Web_colors Web Colors]. See also [[Help:Mediawiki color]] for more information about colors in Powerpedia.
== 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}}


== DOE green==
== See also ==
If you want to use {{color|#0F6636|DOE Green}}, use #0F6636 in the color name like this: {{tlx|color|#0F6636|DOE Green}}. To get the same color outside Powerpedia in software that uses RGB color codes, the equivalent RGB code is 15, 102, 54.
* {{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


==Accessibility==
== TemplateData ==
{{#lsth:Accessibility|Color}}
{{TemplateData header}}
==See also==
<templatedata>
* {{tlx|background}} to set both the text color and the background color.
{
"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:Color templates]]</includeonly>
<includeonly>{{Sandbox other|
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
[[Category:Text color templates| ]]
}}</includeonly>

Revision as of 10:35, 13 July 2024

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

See also

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Color in articles based on its TemplateData.

TemplateData for Color

The color template can be used to add a span of text with any given text color

Template parameters

ParameterDescriptionTypeStatus
Color1

CSS name of color or hex code of color, e.g. 'red' or '#00F000'.

Stringrequired
Text2

The string of text to be formatted in the desired color

Stringsuggested