Template:Greater color contrast ratio/doc

This template determines the pair of colors with the larger contrast ratio: color1/color2 or color1/color3. This is useful for selecting a foreground/background color pair. For accessibility, WCAG 2.0 AA guidelines require a contrast ratio of 3 or larger for large text, and 4.5 or larger for normal sized text. When used in the default mode, with color2 and color3 equal to white and black, the selected color pair will always have a contrast ratio greater than 4.58.

Examples edit

  • <span style="background:navy; color:Template:Tlf">Navy</span>Navy
  • <span style="Template:Tlf">Navy</span>Navy
  • <span style="Template:Tlf">Navy</span>Navy
  • <span style="background:red; color:Template:Tlf">Red</span>Red
  • <span style="Template:Tlf">Red</span>Red
  • <span style="Template:Tlf">Red</span>Red
  • <span style="background:white; color:Template:Tlf">White</span>White
  • <span style="Template:Tlf">White</span>White
  • <span style="background:black; color:Template:Tlf">Black</span>Black
  • <span style="Template:Tlf">Black</span>Black
  • <span style="background:#005500; color:Template:Tlf">#005500</span>#005500
  • <span style="Template:Tlf">#005500</span>#005500
  • <span style="background:#005500; color:#Template:Tlf">005500</span>005500
  • <span style="Template:Tlf">005500</span>005500
  • <span style="background:#CC5500; color:#Template:Tlf">CC5500</span>CC5500
  • <span style="Template:Tlf">CC5500</span>CC5500
  • <span style="background:#CC5500; color:#Template:Tlf">CC5500</span>CC5500
  • <span style="Template:Tlf">CC5500</span>CC5500
  • <span style="background:Not a color; color:#Template:Tlf">Not a color</span>Not a color
  • <span style="Template:Tlf">Not a color</span>Not a color

Optional parameters edit

The bias parameter should be used with caution to ensure accessibility. As stated above, when used without a bias, and with color2 and color3 equal to white and black, the selected color pair will always have a contrast ratio greater than 4.58. A bias of 1.25, reduces the possible minimum to 4.0, which may not meet accessibility standards.

See also edit