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

Module:Color contrast/doc: Difference between revisions

From Poets.Wiki
From Wikipedia
No edit summary
Line 13: Line 13:
* {{tl|Greater color contrast ratio}}
* {{tl|Greater color contrast ratio}}
It is also used for tracking within
It is also used for tracking within
* [[Module:Navbox]]
* Module:Navbox
* [[Module:Userbox]]
* Module:Userbox
* [[Module:Episode list]]
* Module:Episode list
and for documentation in
and for documentation in
* [[Module:College color]]
* Module:College color


The formulas used are [https://www.w3.org/WAI/GL/wiki/Relative_luminance#Definition_as_Stated_in_WCAG_2.x stated in WCAG 2.x specifications]. [[WCAG]] is the main guideline for creating accessible interfaces on the web.
The formulas used are [https://www.w3.org/WAI/GL/wiki/Relative_luminance#Definition_as_Stated_in_WCAG_2.x stated in WCAG 2.x specifications]. WCAG is the main guideline for creating accessible interfaces on the web.


== Usage ==
== Usage ==

Revision as of 17:04, 6 April 2025

This page uses Creative Commons Licensed content from Wikipedia (view authors).

Template:High-use

This module is used primarily by

It is also used for tracking within

  • Module:Navbox
  • Module:Userbox
  • Module:Episode list

and for documentation in

  • Module:College color

The formulas used are stated in WCAG 2.x specifications. WCAG is the main guideline for creating accessible interfaces on the web.

Usage

To use this module, you may use one of the above listed templates or invoke the module directly

  • To compute relative luminescence:
    {{RGBColorToLum|color}} or {{#invoke:Color contrast|lum|color}}
  • To compute a contrast ratio between two colors:
    {{Color contrast ratio|color1|color2|error=?}} or {{#invoke:Color contrast|ratio|color1|color2|error=?}}
  • To determine which of two colors (color2a and color2b) has the greater contrast ratio with a particular color (color1):
    {{Greater color contrast ratio|color1|color2a|color2b}} or {{#invoke:Color contrast|greatercontrast|color1|color2a|color2b}}
  • To compute the contrast ratio between the background and text colors specified in a css style string:
    {{#invoke:Color contrast|styleratio|css style statement string|default background color|default text color}}
Contents