• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:CellCategory

  • Template
  • Talk
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]

This template implements an accessible color scheme for table cell backgrounds based on a light Brewer palette called Pastel 2. The generated color code is produced by {{CategoryBgColor}} which can be used as a parameter for table legends, boxes and others. Original colors were lightened slightly to achieve WCAG AA with text and links (including inline citations) and may be revised when Wikipedia's default style changes. The order was also changed to promote the pairs least modified by lightening. Pastel 2 was chosen because it is the Brewer palette that requires the least modifications to achieve this accessibility goal.

As a qualitative/categorical palette, these colors should not be used with any specific meaning related to preference (good or bad) or magnitude (intensity, frequency, etc.), and may change in the future, maintaining only the property of serving to differentiate between categories. For comparison tables, see the other table cell templates associated with specific meanings.

Although the WCAG level guarantees the readability of the text, the lightness is about the same in all the colors produced, not following color universal design and, therefore, impacting some colorblind readers. Unfortunately, the only solution to this is to reduce lightness below WCAG AA levels for some colors, decreasing accessibility for many people. Therefore, if the category is important, it should also be represented as text in the table, not just as color.

The palette provides these colors for 8 categories:

1 2 3 4 5 6 7 8

Contents

  • 1 Usage example
  • 2 Code
  • 3 TemplateData
  • 4 See also

Usage example

edit

Wikitext:

...
|{{CellCategory |1 |Info on category 1}}
|-
|{{CellCategory |3 |Info on category 3}}
|-
|{{CellCategory |2 |Info on category 2}}
...

{{Legend inline |#{{CategoryBgColor|1}} |Category 1}}
{{Legend inline |#{{CategoryBgColor|2}} |Category 2}}
{{Legend inline |#{{CategoryBgColor|3}} |Category 3}}

Result:

Info on category 1
Info on category 3
Info on category 2

  Category 1   Category 2   Category 3

Code

edit

Code specific to this template:

style="color:black;background: #EBEBEB;"|

TemplateData

edit
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:CellCategory in articles based on its TemplateData.

TemplateData for CellCategory

A template for coloring table cells with an accessible qualitative palette.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
category1

category index

Default
?
Numbersuggested
text2

text to fill the cell

Default
Contentoptional
alignmentalign

cell text alignment for when the Table alignment template doesn't work; values: 'tl' (top left), 'tc' (top center), 'tr' (top right), 'ml' (middle left), 'mc' (middle center), 'mr' (middle right), 'bl' (bottom left), 'bc' (bottom center), 'br' (bottom right)

Default
Lineoptional

See also

edit
  • Unified table cell templates
  • {{Table alignment}} to set cell alignment for entire columns instead of single table cells
  • Color coding in data visualization
The above documentation is transcluded from Template:CellCategory/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:CellCategory&oldid=1233942257"
Last edited on 11 July 2024, at 18:56

Languages

    • العربية
    • اردو
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 11 July 2024, at 18:56 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop