Difference between revisions of "Template:Bgcolor"

From BlogNomic Wiki
Jump to navigation Jump to search
(use a more commonplace example)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
  
 
Example: <pre><nowiki>{| class="wikitable" style="text-align:center"
 
Example: <pre><nowiki>{| class="wikitable" style="text-align:center"
! !! A !! B
+
! Player !! Score !! Danger
 
|-
 
|-
! 1
+
! Chico
| {{bgcolor|yellow}}    | O
+
|                       | 95
| {{bgcolor|white|grey}} | X
+
| {{bgcolor|red|yellow}} | High
 
|-
 
|-
! 2
+
! Groucho
| {{bgcolor|#aaffaa}}    | ?
+
| {{bgcolor|#ffff88}}    | 132
| {{bgcolor|#ffaaff}}   | !
+
| {{bgcolor|lightgreen}} | Low
 +
|-
 +
! Harpo
 +
|                        | 43
 +
| {{bgcolor|lightgreen}} | Low
 
|}</nowiki></pre> produces:
 
|}</nowiki></pre> produces:
  
 
{| class="wikitable" style="text-align:center"
 
{| class="wikitable" style="text-align:center"
! !! A !! B
+
! Player !! Score !! Danger
 +
|-
 +
! Chico
 +
|                        | 95
 +
| {{bgcolor|red|yellow}} | High
 
|-
 
|-
! 1
+
! Groucho
| {{bgcolor|yellow}}     | O
+
| {{bgcolor|#ffff88}}   | 132
| {{bgcolor|white|grey}} | X
+
| {{bgcolor|lightgreen}} | Low
 
|-
 
|-
! 2
+
! Harpo
| {{bgcolor|#aaffaa}}    | ?
+
|                       | 43
| {{bgcolor|#ffaaff}}   | !
+
| {{bgcolor|lightgreen}} | Low
 
|}
 
|}
 +
 +
==Related templates==
 +
* [[Template:Gridcell]], the same template but which also sets a minimum, square height and width for the cell
 +
 
[[Category:Display templates]]</noinclude>
 
[[Category:Display templates]]</noinclude>

Latest revision as of 09:32, 16 August 2024

style="background-color:{{{1}}};"

Usage

This template generates CSS for table cell backgrounds, for use in wiki markup tables. It takes one or two colour inputs, which can be hex including the hash (eg. #69B3E7) or a web colour term (eg. aquamarine).

If only one colour is specified, the box background is that colour. If two are specified, the background shades a gradient from one to the other, top left to bottom right.

Example:

{| class="wikitable" style="text-align:center"
! Player !! Score !! Danger
|-
! Chico
|                        | 95
| {{bgcolor|red|yellow}} | High
|-
! Groucho
| {{bgcolor|#ffff88}}    | 132
| {{bgcolor|lightgreen}} | Low
|-
! Harpo
|                        | 43
| {{bgcolor|lightgreen}} | Low
|}

produces:

Player Score Danger
Chico 95 High
Groucho 132 Low
Harpo 43 Low

Related templates

  • Template:Gridcell, the same template but which also sets a minimum, square height and width for the cell