Template:BrewerColors

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:BrewerColors/doc.

This template shows the Brewer colors. Based on specifications and designs developed by Cynthia Brewer ([1]). These color palettes can be used for statistical diagrams and for maps.


Syntax[edit]

{{BrewerColors|color palette|number of colors|show the color number}}

The number of colors must be from 3 to 9 or 12, according to the palette.

Show the color number is an optional parameter, with two values: '-' the color number and 'a' with the degree of transparency (alpha channel) added at the end of the number and always it will be 'ff'. It is only interesting to add the color for the map coloring.

Brewers color palettes[edit]

Valid names and full color representation for each palette. Moving the mouse cursor over each box the color number appears.

Sequential (1-9)

  • YlGn
                                       
  • YlGnBu
                                       
  • GnBu
                                       
  • BuGn
                                       
  • PuBuGn
                                       
  • PuBu
                                       
  • BuPu
                                       
  • RdPu
                                       
  • PuRd
                                       
  • OrRd
                                       
  • YlOrRd
                                       
  • YlOrBr
                                       
  • Purples
                                       
  • Blues
                                       
  • Greens
                                       
  • Oranges
                                       
  • Reds
                                       
  • Greys
                                       

Divergent (1-11)

  • PuOr
                                               
  • BrBG
                                               
  • PRGn
                                               
  • PiYG
                                               
  • RdBu
                                               
  • RdGy
                                               
  • RdYlBu
                                               
  • Spectral
                                               
  • RdYlGn
                                               

Qualitative (1-8/12)

  • Accent
                                   
  • Dark2
                                   
  • Paired
                                                   
  • Pastel1
                                       
  • Pastel2
                                   
  • Set1
                                       
  • Set2
                                   
  • Set3
                                                   

Template data[edit]

<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

Discussion
There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.


Wikipedia's help about TemplateDataCommons-specific information

Show colors of Brewer palettes

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Palette name1

Name of the palette to use

Linerequired
Number of colors2

The number of colors to show on the palette, from 3 to 9/12

Numberrequired
Show color number3

Write the color number after the box: - (only number) or (with alpha channel)

Numberoptional

Examples[edit]

Code Result
{{BrewerColors|Greens|3}}            
{{BrewerColors|Greens_i|3}}            
{{BrewerColors|Set1|8}}                                
{{BrewerColors|Accent|4|-}}     #7fc97f       #beaed4       #fdc086       #ffff99  
{{BrewerColors|Accent|4|a}}     #7fc97fff       #beaed4ff       #fdc086ff       #ffff99ff  

See also[edit]