Template:ColorString

From Wikimedia Commons, the free media repository
(Redirected from Template:Legtab)
Jump to navigation Jump to search

This template creates one or more color boxes or lines, together by a text string which may contain also wikilinks.

It can be transcluded with Legtab, Leglin, Colorstring, and also by Image generation with the parameter |cb=

  • The parameter |cb= needs a slash-separated sub-parameter sequence,
  • the other templates can be provided with either pipe-separated or slash-separated parameters.

The template has either only one unnamed parameter, a string of possible subparameters separated by slashes,
or unnamed parameters separated by pipes; in both cases an unlimited number of (sub)parameters can be specified.

Subparameters

are either pairs of colorcode and text, or just the colorcodes. Each valid color code (CSS color names, hex triplet, tincture names) can be used.
The text can be also wiki-formatted, e.g. a link.
In any case, the parameter sequence can start with an optional pair of control codes preceding the parameter string;
they are also slash/pipe-separated, e.g. "-/-", specifying

  • the possibility to create a field name, when used within |other fields 1 or |other fields
  • the layout of the color box[es] or color line[s].

The first control code may be (see Igen/cbox)

  • "-" or missing: default;
  • "+" requesting the generation of a field name
  • "e" only when the second code is "T": an "e" will display a bordered example of the file

The second control code specifies

¹) the "L" possibility exists just for completion – normally a "Legend" without an explaining second value will not be useful.
When parameter lists of pairs ("", " ", "C", "D", "-", "M", "T") should contain an URL address
in the second parameter, that is only possible with a parameter list separated by pipes "|"
(otherwise the slashes in the URL address would disturb a slash-separated parameter list).

Whenever possible, the boxes are tooltipped.

In a Legend with parameter pairs ("", " ", "C", "-", "M")

  • Legend-lines can be drawn, by just expanding the color value e.g. #030 to #030 dashed 2px
  • a workaround exists for striped and bordered boxes, by an extension of the the first parameter:
  • the color value is preceded by a sequence of one character and ")", e.g. "6)" for SVGstripes6.svg
000  2 spaces: the CSS code for the line, e.g. "#F00 solid 2px":
 line
000  3 spaces: the color value is followed by a space and the CSS code for the border, e.g. "#FF0 #F00 2px dotted":
 
bordered legend
000  4 spaces: the color value is followed by two spaces and the CSS code for the line, e.g. "#FF0  3px dashed red":
 
line wth background
  • the second parameter, the descriptional text, can be ("", " ", "=", "#", "<"); then the first parameters color is used:
  • empty or =: the first value will be displayed.
  • # like = but when the first value is a color name, its code becomes displayed
  • < like # but the code display is teletyped

Examples[edit]

See there an example with many colors. See there examples for Tbc parametrizing.

This parameter string... ...yields:
#FF0
 
#FF0
/B/vert/#396 vert#396
/D/#BC3F4A/sanguine sanguine
 lime/{{W|green}}
/#0f47af/azure
/#DA121A/gules
/#999/{{Wf|cendrée}}
 
azure
 
gules
with hex codes (and pipes):

-|S|#000|#00f|#F0F|#396
  #000
  #00f
  #F0F
  #396
with the (full!) tincture names:

argent//argent-d//or//
azure//carnation//céleste//
cendrée//gules//naranja//
purpure//sable//tawny//vert
//invisible
 
argent
 
argent-d
 
or
 
azure
 
carnation
 
céleste
 
cendrée
 
gules
 
naranja
 
purpure
 
sable
 
tawny
 
vert
 
transparent
with exotic tincture names
 /L/brunâtre/murrey/
 orange_t/sanguine
 
brunâtre
 
murrey
 
orange_t
 
sanguine
with the CSS color names:

/S/black/silver/maroon/red/
green/lime/olive/yellow/
navy/blue/purple/fuchsia/
teal/aqua/gray/olivedrab/
azure_CSS
  black
  silver
  maroon
  red
  green
  lime
  olive
  yellow
  navy
  blue
  purple
  fuchsia
  teal
  aqua
  gray
  olivedrab
  azure_CSS
with URL addresses and other links
|M|Peru|{{W|Peru}}|plum|{{Plainlinks|
https://en.wikipedia.org/wiki/Plum|
URL1}}|crimson}}
  Peru
  URL1
  crimson
striped legend (see the "striped" description)
this example with second parameter empty or space
 / /0)#000/ /1)#900/ /2)#369/ /3)wmg/ 
striped 0
#000
striped 1
#900
striped 2
#369
striped 3
wmg
{{Legend-line}}s within a legend table:
 //#DA2/desert/#03C solid 3px
/stream/#030 dashed 2px/border
/G)#8CF/glacier
(precede with two slashes to set the lines width)
 
desert
 stream
 border
striped G
glacier
{{Legend-line}}s and small legends:
 /-/#D00/area 1/#F00 solid 3px
/line 1/#0CC/area 2
/#030 dotted 3px/line 2
(precede with /-/ or /M/ to set the small width)
  area 1
 line 1
  area 2
 line 2
Bordered Legends:
/#F00 #030 dotted 3px/dotted border
/1)blue solid 1px red/solid border
/#FFF 7px #000 solid/fat border
An example for same-colored borders:
/lime lime solid 1px/ /Orchid Orchid solid 1px/ /<br />
/gules gules solid 1px/ /#DFD  navy solid 3px/line;


 
dotted border
striped 1
solid border
 
fat border


 
lime
 
Orchid
 
gules
 
line;