Difference between revisions of "Template:Color/doc"

From blackwiki
Jump to navigation Jump to search
imported>Greyjoy
(Undid revision 732644185 by 66.87.134.148 (talk))
imported>Koavf
 
(11 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}} __NOTOC__
 
{{Documentation subpage}} __NOTOC__
<includeonly>{{High-risk|122,000+}}</includeonly>
 
 
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
 +
{{High-use| 122,000 }}
  
 
This template 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 {{tl|background color}}.
 
This template 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 {{tl|background color}}.
Line 20: Line 20:
 
===Performance considerations===
 
===Performance considerations===
 
The template generates an HTML span tag:
 
The template generates an HTML span tag:
:{{code|<nowiki><span style="color:{{{1}}}">{{{2}}}</span></nowiki>}}
+
<nowiki><span style="color:{{{1}}}">{{{2}}}</span></nowiki>
 
It runs at speeds in excess of 700 per second, and so is functionally identical to using the HTML markup directly.
 
It runs at speeds in excess of 700 per second, and so is functionally identical to using the HTML markup directly.
  
 
===Template data===
 
===Template data===
{{TemplateDataHeader}}
+
{{TemplateData header}}
 
<templatedata>
 
<templatedata>
 
{
 
{
        "description": "The color template can be used to add a span of text with any given text color",
+
"description": "The color template can be used to add a span of text with any given text color",
        "params": {
+
"params": {
                "1": {
+
"1": {
                        "label": "Color",
+
"label": "Color",
                        "description": "CSS name of color or hex code of color, e.g. 'red' or '#00F000'.",
+
"description": "CSS name of color or hex code of color, e.g. 'red' or '#00F000'.",
                        "type": "string",
+
"type": "string",
                        "required": true
+
"required": true
                },
+
},
                "2": {
+
"2": {
                        "label": "Text",
+
"label": "Text",
                        "description": "The string of text to be formatted in the desired color",
+
"description": "The string of text to be formatted in the desired color",
                        "type": "string",
+
"type": "string",
                        "required": true
+
"suggested": true
                }
+
}
        }
+
}
 
}
 
}
 
</templatedata>
 
</templatedata>
 +
 +
===Redirects===
 +
* {{tlg|COLOR|nolink=on|code=on}}
 +
* {{tlg|Colored text|nolink=on|code=on}}
 +
* {{tlg|Colour|nolink=on|code=on}}
 +
* {{tlg|COLOUR|nolink=on|code=on}}
 +
* {{tlg|Fgcolor|nolink=on|code=on}}
  
 
===See also===
 
===See also===
 
* {{tl|resize}}
 
* {{tl|resize}}
* {{tl|linkcolor}}
+
* {{tl|colored link}}
* {{tl|font color}} – sets both text and background color
+
* {{tl|background color}}
* {{tl|background color}} – sets background color only
+
* {{tl|font color}} – allows setting both text and background color
 +
* {{tl|coltit}} – colored table header cell
 +
 
  
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
+
<includeonly>{{Sandbox other|
 
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
 
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
 
[[Category:Text color templates| ]]
 
[[Category:Text color templates| ]]
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 21:05, 29 June 2020

This template 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:

Template:Tbullet Template:Tbullet

If the second parameter is omitted, the color value is displayed as text:

Template:Tbullet Template:Tbullet

Performance considerations

The template generates an HTML span tag:

<span style="color:{{{1}}}">{{{2}}}</span>

It runs at speeds in excess of 700 per second, and so is functionally identical to using the HTML markup directly.

Template data

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

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

Redirects

  • {{COLOR}}
  • {{Colored text}}
  • {{Colour}}
  • {{COLOUR}}
  • {{Fgcolor}}

See also