This template displays a table to provide the legend for a chart or diagram that uses colours.

The template allows for 16 pairs of colour / description.

Parameters

edit
1
Colour for the first legend. Colours may be names, RGB codes of the form #88FF66 or #456
2
Text of the first legend
3,5,7 ... 31
Further colours. The template allows for 16 colours in the list
4,6,8 ... 32
Further texts
invert
If nonempty, invert in dark mode. Often useful for tables.
title
Optional title displayed above the colour list
title-align
Alternative alignment for the title. If omitted, the title is centred.
style
Complete replacement of the default style. The default style sets a background colour and an enclosing border.
width
Replacement for the default width of 100%. width=auto will display a box that just fits the legend table.
notes
Optional footnotes displayed after the colour list.

Examples

edit
{{legend table|width=auto
|red|Red
|green|Green
|blue|Blue
}}

Gives:

  Red
  Green
  Blue
{{legend table|title=This is an optional title
|#000000|Kosovo
|#0052ff|States which formally recognise Kosovo as independent.<sup>1</sup>
|#5fadff|States which have stated they intend to recognise formally Kosovo as independent.
|#cdcd9c|States with undecided, unclear or ambiguous positions.
|#E5A238|States which have expressed disagreement with unilateral moves or expressed wish for further negotiations.
|#FF4500|States which have stated they will not recognise Kosovo as independent.
|#a3a3a3|States with no reported position at present.
|notes=<sup>1</sup>These are optional footnotes.
}}

Gives:

This is an optional title
  Kosovo
  States which formally recognise Kosovo as independent.1
  States which have stated they intend to recognise formally Kosovo as independent.
  States with undecided, unclear or ambiguous positions.
  States which have expressed disagreement with unilateral moves or expressed wish for further negotiations.
  States which have stated they will not recognise Kosovo as independent.
  States with no reported position at present.

1These are optional footnotes.

{{legend-table|title=Periodic table key legend
|#006000|The [[CHON|four basic organic elements]]
|#00b000|Quantity elements
|#7f0|Essential [[dietary element|trace elements]]
|#ee0|Essentiality or function debated
|#ebba36|Not essential in humans, but essential for some non-human eukaryotes
|#ffc4ef|Not essential in eukaryotes, but essential for some prokaryotes
|invert=yes}}
Periodic table key legend
  Quantity elements
  Essential trace elements
  Essentiality or function debated
  Not essential in humans, but essential for some non-human eukaryotes
  Not essential in eukaryotes, but essential for some prokaryotes

See also

edit


This template displays a table to provide the legend for a chart or diagram that uses colours. The template allows for 16 pairs of colour / description.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Stylestyle

Complete replacement of the default style. The default style sets a background colour and an enclosing border.

Stringoptional
Widthwidth

Replacement for the default width of 100%. 'auto' will display a box that just fits the legend table.

Stringoptional
Titletitle

Optional title displayed above the colour list.

Stringoptional
Title aligntitle-align align

Alternative alignment for the title. If omitted, the title is centred.

Suggested values
center left right
Default
center
Stringoptional
Notesnotes

Optional footnotes displayed after the colour list.

Contentoptional
Invert in dark modeinvert

If nonempty, invert in dark mode.

Contentoptional
Color 11 c color c1 color1

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Linesuggested
Label 12 t text label t1 text1 label1

Text or content to label the legend.

Contentsuggested
Color 23 c2 color2

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 24 t2 text2 label2

Text or content to label the legend.

Contentoptional
Color 35 c3 color3

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 36 t3 text3 label3

Text or content to label the legend.

Contentoptional
Color 47 c4 color4

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 48 t4 text4 label4

Text or content to label the legend.

Contentoptional
Color 59 c5 color5

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 510 t5 text5 label5

Text or content to label the legend.

Contentoptional
Color 611 c6 color6

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 612 t6 text6 label6

Text or content to label the legend.

Contentoptional
Color 713 c7 color7

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 714 t7 text7 label7

Text or content to label the legend.

Contentoptional
Color 815 c8 color8

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 816 t8 text8 label8

Text or content to label the legend.

Contentoptional
Color 917 c9 color9

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 918 t9 text9 label9

Text or content to label the legend.

Contentoptional
Color 1019 c10 color10

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1020 t10 text10 label10

Text or content to label the legend.

Contentoptional
Color 1121 c11 color11

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1122 t11 text11 label11

Text or content to label the legend.

Contentoptional
Color 1223 c12 color12

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1224 t12 text12 label12

Text or content to label the legend.

Contentoptional
Color 1325 c13 color13

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1326 t13 text13 label13

Text or content to label the legend.

Contentoptional
Color 1427 c14 color14

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1428 t14 text14 label14

Text or content to label the legend.

Contentoptional
Color 1529 c15 color15

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1530 t15 text15 label15

Text or content to label the legend.

Contentoptional
Color 1631 c16 color16

Colour for the legend. Colours may be names or RGB codes of either 6 or 3 digits.

Example
Magenta, #FF00FF, or #F0F
Lineoptional
Label 1632 t16 text16 label16

Text or content to label the legend.

Contentoptional