Template:Color sample/doc

Template page

Usage

  • {{Color sample|red}} → 
  • {{Color sample|#00FF00}} → 
  • {{Color sample|#00FF00|description=green}} → 
    Adds a description of the color for screen reader users
  • {{Color sample|{{party color|Independent politician}}}} → <span style="display:inline-block;width:1em;vertical-align: text-top;height:1em;border:1.62px solid black;background:Lua error in package.lua at line 80: module 'Module:Political party/I' not found.;" title="Template:Title case"> 
    (Instead of specifying a color directly, this example uses {{party color|Independent politician}}, which generates Lua error in package.lua at line 80: module 'Module:Political party/I' not found..)

Size option:

  • A second parameter allows to define the size of the square: 1 is large (default), 0.6 is quite small, 0.2 is minuscule. Examples:
{{Colorsample|#008000}} or {{Colorsample|#008000|1}} gives: Template:Colorsample
{{Colorsample|#008000|0.5}} gives: Template:Colorsample
{{Colorsample|#008000|0.2}} gives: Template:Colorsample

Note: When hovered over, the template shows the value used for color as a tooltip by default. This is also heard by a screen reader. An optional parameter, |description= can be used to change that to something more user-friendly, as shown in the third example.

See also