Edge Rewrite
Jump to content

Template:Color sample/doc

From Wikipedia, the free encyclopedia

Usage

[edit]
  • {{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}}}} →  
    (Instead of specifying a color directly, this example uses {{party color|Independent politician}}, which generates #DCDCDC.)

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:
    {{Color sample|#008000}} or {{Color sample|#008000|1}} gives:  
    {{Color sample|#008000|0.5}} gives:  
    {{Color sample|#008000|0.2}} gives:  

Parameters

[edit]
|1=CSS color
The color of the sample. See Web colors.
|2=number
Size of the box in em units. Examples: {{Color sample|purple|0.5}} →  , {{Color sample|purple|1.5}} →  
|w=number and |h=number
An alternative to |2= to specify the width and height separately.
|border-color=CSS color
The color of the border. Examples: {{Color sample|purple|border-color=orange}} →  , {{Color sample|purple|border-color=#0FF}} →  
|border-width=CSS size
The width of the border around the color sample. Examples: {{Color sample|purple|border-width=3px}} →  , {{Color sample|purple|border-width=0.15cm}} →  
|description=text
An override of the text for the title HTML attribute. Shows up as a tooltip when a mouse cursor is hovering over the color sample. When hovered over, the template shows the value used for color as a tooltip by default. This is also heard by a screen reader. This parameter can be used to change that to something more user-friendly. Double quotations must be escaped as an HTML character entity ".

See also

[edit]