Template:Table cell templates/doc
| This is a documentation subpage for Template:Table cell templates It contains usage information, categories and other content that is not part of the original template page. |
Di templates for dis series, insyd dem {{Table cell templates}}, dem make am so you fit use dem for table to create one cell wey get text plus di correct background color. Plenty pipol dey use dem for comparison tables. Most of dis templates no suppose be just for background color alone; use dem according to wetin dem mean.
For example, {{yes}} dey make one cell wey get green background. Di text wey go show for di cell dey come from di first parameter; {{yes|Sure}} go show "Sure", if not e go use "Yes" by default. Most templates allow editors make dem change di default text by using |1= or something wey be like dat. Some templates need make you put di text after di template call, and oda ones need one vertical bar (|) separate dem: {{table cell template}} text or {{table cell template}} | text. You fit see all dis information, plus di colors and default texts, for di table below.
Important: If you wan use oda attributes for di table cells wey no dey appear for {{Section link}}: required section parameter(s) missing below, like colspan, rowspan, or style, you for put dem before di template call, and no put vertical bar (|) between dem. Example:
| Yes | No | N/a |
|---|---|---|
| Yes/No | ||
...
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 style="border:solid 3px Maroon" {{Yes-No}}
...
Templates
[edit source]Dis be template wey go make wanna references make structured.
Code
[edit source]Common code wey almost all di templates for dis series dey use:
style="background: #abcdef; color: black; vertical-align: middle; text-align: {{{align|center}}}; {{{style|text-transform: capitalize;}}}" class="automatic table-automatic"| {{{1|text}}}
Creating new templates
[edit source]If you wan create new table cell template, you fit use:
{{subst:Table cell templates|text= default text |bg= background color |class= a class name without prefix |align= standard horizontal alignment}}
You suppose leave out di align parameter, and plenty times di class parameter no dey necessary too.
After dat, add di new template to di table for di common documentation. If possible, try reuse one of di existing templates, and choose di color well.
If you see one table cell template wey no dey accept parameter and you wan make people fit change di text inside di cell, no create another copy of di template! Instead, edit di existing template and change di text make e use one default parameter substitution. For example, if di template text be Dropped, change am to {{{1|Dropped}}}.
style="background: #abcdef; color: black; vertical-align: middle; text-align: {{{align|center}}}; {{{style|}}}" class="automatic table-automatic"| {{{1|text}}}
Choosing a color
[edit source]When you dey change or create new template, follow di guidelines for using colors and di when you dey choose di background color and, sometimes, di text color. Plenty of dis templates fit contain links to oda pages or references, so di links for show clear against di background color.
You fit check di contrast level by using di WebAIM contrast checker. Set di foreground color to di blue link color. Di contrast suppose reach at least WCAG AA level, and if e possible, WCAG AAA level. Wikipedia:Manual of Style/Accessibility/Colors get list of colors wey satisfy WCAG AAA and WCAG AA requirements for normal text and unvisited links.
Color subpage
[edit source]Every template suppose get either one /bgcolor subpage wey contain only one valid CSS color code (if necessary, e fit dey inside nowiki tags), for example #BFD. You fit include am with background: {{/bgcolor}}; inside di style attribute.
Or, di template fit reference another template ein color subpage, for example background: {{Template:Yes2/bgcolor}};. Another option be say di /bgcolor subpage fit redirect go another color-code subpage, for example #REDIRECT [[yes2/bgcolor]].
Dis way, pages wey dey use dese templates fit also use {{legend}} and similar templates wey fit reference di actual color:
{{legend|{{yes2/bgcolor}}|supported}}
TemplateData
[edit source]TemplateData for Table cell templates
One of several templates for styling individual table cells with standard contents and colors.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| text | 1 | text to be displayed instead of the default; if this doesn't work put the text after the template, possibly with a vertical bar | in between
| Content | optional |
| horizontal align | align | text alignment inside the cell, either 'left', 'right', 'center' or 'justified'
| String | optional |
| style | style | a semicolon-separated list of additional CSS rules to be applied to the table cell
| String | optional |
| background color | color | a valid CSS color value or name to override the standard cell background, only available with some templates
| Line | optional |
See also
[edit source]- {{Change}} – e dey calculate, show, and add color codes to changes between two values
- {{Cell color}} – shaded cell wey dey depend on value for one range, with automatic text visibility
- {{BSD-lic}} – special redirect for {{free}}
- {{GPL-lic}} – special redirect for {{free}}
- {{LGPL-lic}} – special redirect for {{free}}
- {{Active}} / {{No result}} / {{Eliminated}} for comparison tables
Notes
[edit source]Dis be template wey go make wanna references make structured.
- ↑ Di HTML class for table cell templates fit be referenced inside one user stylesheet make e change how e dey look.
- 1 2 Dis template no dey take parameter; you for put di content after di template call, separate am with one pipe (|) character.
- ↑ Dis template relate to Template:WikiProject link.
- ↑ Dis template relate to Template:WikiProject link.
- ↑ Dis group of templates relate to Template:WikiProject link.
- ↑ Dis template relate to Template:WikiProject link.
- ↑ Dis group of templates relate to Template:WikiProject link.
- ↑ Dis group of templates relate to Template:WikiProject link.
- ↑ Dis group of templates relate to Template:WikiProject link.