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
m Rewrite doc.
m Change ref link. Add sample.
Line 5: Line 5:
: {{T|Co|<text color>|<background color>|<text>}}
: {{T|Co|<text color>|<background color>|<text>}}
: {{T|Co|<text color>|<text>}}
: {{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}}).
:; 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/colors/colors_names.asp [2022-05-29]</ref> (e.g. {{Co|red|red}} or {{Co|green|green}}) or values<ref>https://www.w3schools.com/colors/colors_hex.asp [2022-05-29]</ref> (like {{Co|#0000FF|#FF0000}}).
:; background color : Sets the background color. Default value is "inherit". For valid values see text color.
:; background color : Sets the background color. Default value is "inherit". For valid values see text color.
:; text : The text to be colored.
:; text : The text to be colored.


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


Line 16: Line 16:
: {{co||green|This text has a green background.}}<br>
: {{co||green|This text has a green background.}}<br>


: {{code|<nowiki>{{co|#0033CC||This text uses an HTML color code.}}</nowiki>}} gives ...
{{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.}}
: {{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.}}
: {{code|<nowiki>{{co|black|lightyellow|Text and background color.}}</nowiki>}} gives ...
: {{co|black|lightyellow|Text and background color.}}
 
: {{code|<nowiki>{{co|#0033CC|This text uses an hex color code.}}</nowiki>}} gives ...
: {{co|#0033CC||This text uses an hex color code.}}


; References
; References

Revision as of 10:59, 29 May 2022

Description
This template is used to color some text.
Syntax
{{Co|<<text color>>|<<background color>>|<<text>>}}
{{Co|<<text color>>|<<text>>}}
text color
Sets the text color. Default value is "inherit"[1]. Colors can be given either by color name[2] (e.g. red or green) or values[3] (like #FF0000).
background color
Sets the background color. Default value is "inherit". For valid values see text color.
text
The text to be colored.
Sample
{{co|red|This text isn't yellow.}}
gives ...
This text isn't yellow.
{{co||green|This text has a green background.}}
gives ...
This text has a green background.

Note: Note the double brackets || 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.

{{co|black|lightyellow|Text and background color.}}
gives ...
Text and background color.
{{co|#0033CC|This text uses an hex color code.}}
gives ...
This text uses an hex color code.
References
  1. ^ inherit - The color used by the HTML parent element.
  2. ^ https://www.w3schools.com/colors/colors_names.asp [2022-05-29]
  3. ^ https://www.w3schools.com/colors/colors_hex.asp [2022-05-29]