# வார்ப்புரு: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.  

In the default mode, color2 and color3 are white and black, and the selected color pair will always have a contrast ratio greater than 4.58.  

## Parameters
A color input can be by name ("khaki") or hextriplet with/without #-prefix ("#F0E68C", "F0E68C")  

: (required): background color  
: first fontcolor. Optional, default = white (#FFFFFF)  
: second fontcolor. Optional, default = black (#000000)  

;The template returns the fontcolor with the greatest contrast:  
:background is : &rarr;  

:background is : &rarr; *(=white)*  

;css text  
- makes the template return css-ready text:
::: <code><span>css=y</span>}}</code>  
::&rarr; <span></span>  

::**Example 1**,  
::<code>&lt;span>Example text on khaki background.&lt;/span></code>  
::&rarr; <code>&lt;span>Example text on khaki background.&lt;/span></code>  
::&rarr; <span>Example text on khaki background.</span>  

::**Example 2**,  
::<code>&lt;span>Example text on #4169E1 background.&lt;/span></code>  
::&rarr; <code>&lt;span>Example text on #4169E1 background.&lt;/span></code>  
::&rarr; <span>Example text on #4169E1 background.</span>  

;bias  
- : reduces contrast-check. A bias of 1.25, reduces the possible minimum to 4.0, which may not meet accessibility standards.
:This 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.  

## Examples
;Navy  
- <code>&lt;span>Navy</span&gt;</code> &rarr; <span>Navy</span>
- <code>&lt;span>Navy</span&gt;</code> &rarr; <span>Navy</span>
- <code>&lt;span>Navy</span&gt;</code> &rarr; <span>Navy</span>
;Red  
- <code>&lt;span>Red</span&gt;</code> &rarr; <span>Red</span>
- <code>&lt;span>Red</span&gt;</code> &rarr; <span>Red</span>
- <code>&lt;span>Red</span&gt;</code> &rarr; <span>Red</span>
;White  
- <code>&lt;span>White</span&gt;</code> &rarr; <span>White</span>
- <code>&lt;span>White</span&gt;</code> &rarr; <span>White</span>
;Black  
- <code>&lt;span>Black</span&gt;</code> &rarr; <span>Black</span>
- <code>&lt;span>Black</span&gt;</code> &rarr; <span>Black</span>
;005500  
- <code>&lt;span>#005500</span&gt;</code> &rarr; <span>#005500</span>
- <code>&lt;span>#005500</span&gt;</code> &rarr; <span>#005500</span>
- <code>&lt;span>005500</span&gt;</code> &rarr; <span>005500</span>
- <code>&lt;span>005500</span&gt;</code> &rarr; <span>005500</span>
;CC5500  
- <code>&lt;span>CC5500</span&gt;</code> &rarr; <span>CC5500</span>
- <code>&lt;span>CC5500</span&gt;</code> &rarr; <span>CC5500</span>
;CC5500,  
- <code>&lt;span>CC5500</span&gt;</code> &rarr; <span>CC5500</span>
- <code>&lt;span>CC5500</span&gt;</code> &rarr; <span>CC5500</span>
;error  
- <code>&lt;span>Not a color</span&gt;</code> &rarr; <span>Not a color</span>
- <code>&lt;span>Not a color</span&gt;</code> &rarr; <span>Not a color</span>
::(returns <code>background-color:Not a color; color:;</code>, and so no color is set; defaults to black-on-white.)  

- <code>&lt;span>Not a color</span&gt;</code> &rarr; <span>Not a color</span>
::(returns <code>background-color:Navy; color:;</code>, and so no *fontcolor* is set; defaults to black. The template did not function.)