Template talk:Color contrast ratio

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconAccessibility
WikiProject iconThis template is within the scope of WikiProject Accessibility, a group of editors promoting better access for disabled or otherwise disadvantaged users. For more information, such as what you can do to help, see the main project page.
WikiProject iconColor Template‑class
WikiProject iconThis template is supported by WikiProject Color, a project that provides a central approach to color-related subjects on Wikipedia. Help us improve articles to good and 1.0 standards; visit the wikiproject page for more details.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.

Wrong ratio?[edit]

I noticed some values do not match with the ones provided by the Colour Contrast Check:

Text Color Background color Sample Code Contrast ratio
Template Tool
#BADFEE black   Sample   {{Color contrast ratio|#BaDFeE|BlAcK}} 0.067215591908977 14.88
red black   Sample   {{Color contrast ratio|red|black}} 0.19040365575019 5.25
#FFFF00 #00FFFF   Sample   {{Color contrast ratio|#FFFF00|#00FFFF}} 0.85641235426468 1.17

Helder 12:31, 6 March 2013 (UTC)[reply]

Note the values provided are the reciprocal of those given by the other tool. That's because the other tool reverses the order of the parameters if the foreground color is lighter than the background color, while this template was designed (and is documented) to provide the correct ratio (less than 1). This is to provide more flexibility for the user, who may want to filter dark-on-light contrasts differently than light-on-dark for hardware or environmental differences. In practice, it just means that you have to check that the value is inside a range instead of being less than a specific value (e.g. 0.25<=x<=4.0 instead of x<=4.0). —[AlanM1(talk)]— 17:59, 14 March 2013 (UTC)[reply]