Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Co/doc: Difference between revisions

Template page
Arin Mara (talk | contribs)
mNo edit summary
m Rewrite doc.
Line 1: Line 1:
<noinclude>{{main|Template:Co}}</noinclude>
; Description
==Usage==
: This template is used to color some text.
{{code|<nowiki>{{co|<text color>|<background color>|<text>}}</nowiki>}}


==Examples==
; Syntax
{{code|<nowiki>{{co|red||This text isn't yellow.}}</nowiki>}}
: {{T|Co|<text color>|<background color>|<text>}}
{{co|red||This text isn't yellow.}}
: {{T|Co|<text color>|<text>}}
:; text color : Sets the text color. Default value is "inherit"<ref>inherit - The color used by the HTML parent element.</ref>. Colors can be given either by color name<ref>https://www.w3schools.com/cssref/css_colors.asp [2021-10-23]</ref> (e.g. {{Co|red|red}} or {{Co|green|green}}) or values<ref>https://www.w3schools.com/cssref/css_colors_legal.asp [2021-10-23]</ref> (like {{Co|#0000FF|#FF0000}}).
:; background color : Sets the background color. Default value is "inherit". For valid values see text color.
:; text : The text to be colored.


{{code|<nowiki>{{co||green|This text has a green background.}}</nowiki>}}
: Sample
{{co||green|This text has a green background.}}<br>
: {{code|<nowiki>{{co|red||This text isn't yellow.}}</nowiki>}} gives ...
: {{co|red||This text isn't yellow.}}


{{code|<nowiki>{{co|#0033CC||This text uses an HTML color code.}}</nowiki>}}
: {{code|<nowiki>{{co||green|This text has a green background.}}</nowiki>}} gives ...
{{co|#0033CC||This text uses an HTML color code.}}
: {{co||green|This text has a green background.}}<br>


Note the double brackets <code>||</code> which means that that section is empty. The background color parameter may be safely omitted without the use of double brackets, but double brackets must be used if only a background color is desired.
: {{code|<nowiki>{{co|#0033CC||This text uses an HTML color code.}}</nowiki>}} gives ...
: {{co|#0033CC||This text uses an HTML color code.}}
 
{{Note|Note the double brackets <nowiki>||</nowiki> which means that that section is empty. The background color parameter may be safely omitted without the use of double brackets, but double brackets must be used if only a background color is desired.}}
 
; References
<references />
<includeonly>[[Category:Formatting templates]]</includeonly>
<includeonly>[[Category:Formatting templates]]</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>
<noinclude>[[Category:Template documentation]]</noinclude>