Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Ensure AAA contrast ratio/doc

Template page

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

         | {{#invoke:Message box|mbox}}
        }}{{#if: |
         |   {{#ifexist:Template:Ensure AAA contrast ratio
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  | 
                 }}
        }}
    | 
   }}

{{#invoke:High-use|main|1=19618|2=|info=|demo=|form=|expiry=|system=}} {{#invoke:Lua banner|main}}

This template checks for compliance with WCAG G17, i.e. that a background–foreground colour combination has got a contrast ratio of more than 7:1. It takes two arguments, the base colour value, and the tracking category, category, to place non-compliant transclusions in. A third parameter, other, is optional; the template will by default calculate the contrast ratio against black and white, on the assumption that it is used in conjunction with {{Greater color contrast ratio}}.

Examples[edit]

  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=navy|category=Test}}
  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=navy|other=|category=Test}}
  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=navy|other=navy|category=Test}}
  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=red|category=Test}}
  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=#CC5500|category=Test}}
  • {{#invoke:DemoTemplate|Ensure AAA contrast ratio|base=asdf|category=Test}}

Templates implementing Ensure AAA contrast ratio[edit]

Templates and the associated tracking categories, {{#if: | {{{alt}}} | {{#if:||{{#if:|{{#ifeq: yes | yes | s | S }}ince | {{#ifeq: yes | yes | a | A }}s of}}}} {{#if:|{{{pre}}} }}{{#if: | {{#ifeq:|us|{{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}

|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} {{#expr:{{{3}}}}}, |{{#expr:{{{3}}}}} {{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}

|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} }}June 2019|{{#if: |{{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}

|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} }}June 2019}}}}{{#if:|{{{post}}}}}{{#ifeq:{{ safesubst:#if: {{safesubst:#invoke:Ns has subpages|main}}

 | {{ safesubst:#titleparts:{{ safesubst:#if:|{{{1}}}|Template:Ensure AAA contrast ratio/doc}}|1}}
 | {{ safesubst:#if:|{{{1}}}|Template:Ensure AAA contrast ratio/doc}}

}}|Wikipedia:Template messages||{{#ifexpr:{{#if:Template|0|1}}+{{#ifeq:yes|yes|0|1}}

|{{#if:{{#if: {{#ifexpr: June 2019 = 1 }} | {{#ifexpr: {{#time:Y|June 2019}} > 2004 | June 2019 | {{#ifexpr: {{#time:Y|June 2019}} > 1989 | {{#time:Y|June 2019}} | before 1990 }}}} | {{#ifexpr: June 2019 > 2004 | {{#if: | {{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}
|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} }} June 2019 | {{#ifexpr:June 2019 > 1989 | June 2019 | before 1990 }}}}}}

 |[[Category:Articles containing potentially dated statements from {{#if: {{#ifexpr: June 2019 = 1 }} | {{#ifexpr: {{#time:Y|June 2019}} > 2004 | June 2019 | {{#ifexpr: {{#time:Y|June 2019}} > 1989 | {{#time:Y|June 2019}} | before 1990 }}}} | {{#ifexpr: June 2019 > 2004 | {{#if: | {{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}
|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} }} June 2019 | {{#ifexpr:June 2019 > 1989 | June 2019 | before 1990 }}}}}}]]{{#ifexist:Category:Articles containing potentially dated statements from {{#if: {{#ifexpr: June 2019 = 1 }} | {{#ifexpr: {{#time:Y|June 2019}} > 2004 | June 2019 | {{#ifexpr: {{#time:Y|June 2019}} > 1989 | {{#time:Y|June 2019}} | before 1990 }}}} | {{#ifexpr: June 2019 > 2004 | {{#if: | {{#if:{{{2}}}|{{#switch:{{#if:{{{2}}}

|{{#switch:{{{2}}}
 |january|jan=1
 |february|feb=2
 |march|mar=3
 |apr|april=4
 |may=5
 |june|jun=6
 |july|jul=7
 |august|aug=8
 |september|sep|sept=9
 |october|oct=10
 |november|nov=11
 |december|dec=12
 |{{#ifexpr:{{{2}}}<0
  |{{#ifexpr:(({{{2}}})round 0)!=({{{2}}})
   |{{#expr:12-(((0.5-({{{2}}}))round 0)mod 12)}}
   |{{#expr:12-(((11.5-({{{2}}}))round 0)mod 12)}}
  }}
 |{{#expr:(((10.5+{{{2}}})round 0)mod 12)+1}}
 }}
}}
|Missing required parameter 1=month!

}}|1=January|2=February|3=March|4=April|5=May|6=June|7=July|8=August|9=September|10=October|11=November|12=December|Incorrect required parameter 1=month!}}|Missing required parameter 1=month!}} }} June 2019 | {{#ifexpr:June 2019 > 1989 | June 2019 | before 1990 }}}}}}

   ||}}
 |[[Category:{{#if:
              ||Articles containing potentially dated statements}}]]}}{{#if:All articles containing potentially dated statements
     |}}}}}}{{#invoke:Check for unknown parameters|check|unknown={{#switch:
 {{#if: 
 | {{{demospace}}}    
 | {{#ifeq:Template|
   | main
   | other
   }} 
 }}

| main = | other | #default = }}|preview=Page using Template:As of with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | alt | bare | df | lc | post | pre | since | url }}:

  • {{Australian television episode ratings}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Australian television episode ratings with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Australian television episode ratings with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Background color}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Background color with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Background color with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox athletics race}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Infobox athletics race with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Infobox athletics race with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox character}}
  • {{Infobox fictional family}}
  • {{Infobox fictional race}}
  • {{Infobox fictional vehicle}}
    • [[:Category:{{#invoke:string|replace|1=Articles using infoboxes for fictional elements with invalid color combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using infoboxes for fictional elements with invalid color combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox comic strip}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Infobox comic strip with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Infobox comic strip with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox music genre}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Infobox music genre with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Infobox music genre with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox television season}}
    • [[:Category:{{#invoke:string|replace|1=Pages using infobox television season with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Pages using infobox television season with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)
  • {{Infobox train}}
    • [[:Category:{{#invoke:string|replace|1=Articles using Template:Infobox train with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}|{{#if:|{{{name}}}|Category:{{#invoke:string|replace|1=Articles using Template:Infobox train with invalid colour combination|2=^:?[Cc]ategory:|3=|plain=false}}}}]] (0)

See also[edit]



Debug data: