Шаблон:Linear-gradient text/doc

Материал из TwentyOneWiki
Перейти к навигации Перейти к поиску

Шаблон:Template shortcuts

Usage

Copy and paste the template below:

{{Linear-gradient text | <!-- Font color 1 --> | <!-- Font color 2 --> | <!-- Font color 3 --> | <!-- Font color 4 --> | <!-- Font color 5 --> | <!-- Font color 6 --> | <!-- Font color 7 --> | <!-- Font color 8 --> | <!-- Font color 9 --> | <!-- Font color 10 --> | <!-- Font color 11 --> | <!-- Font color 12 --> | <!-- Font color 13 --> | <!-- Font color 14 --> | <!-- Font color 15 --> | <!-- Font color 16 --> | <!-- Font color 17 --> | <!-- Font color 18 --> | <!-- Font color 19 --> | <!-- Font color 20 --> | text = | direction = | alt text color = }}
Note: This template can handle a maximum of 20 colors, more than that will cause the template to break.

For better understanding see Examples & TemplateData below.

Examples

Basics

  • Atleast two font colors are required for this template to run properly, otherwise it will show up in the Alternate text color (black by default). For example:
{{Linear-gradient text | red | text = Hello, World! | direction = right | alt text color = green }}
gives: Hello, World!
BUT
{{Linear-gradient text | red | blue | text = Hello, World! | direction = right | alt text color = green }}
gives: Hello, World!
  • {{Linear-gradient text | red | green | #0000ff | text = Hello, World! | direction = top | alt text color = #F0E68C }}
gives: Hello, World!
Notice how the colors appear to be moving towards top direction, in the same order as they appear on the template.
  • {{Linear-gradient text | red | green | #0000ff | text = Hello, World! | direction = right | alt text color = purple }}
gives: Hello, World!
Notice how the colors appear to be moving towards right direction, in the same order as they appear on the template.
  • Alternatively text parameter can substituted by 21, direction parameter by 22 and alt text color parameter by 23. For example:
{{Linear-gradient text | red | green | #0000ff | 21 = Hello, World! | 22 = right | 23 = purple }}
gives: Hello, World!
Notice that this alternative syntax also provides the same result as the previous example.
  • {{big|{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | #ffaa00| #008888 | text = Welcome to Wikipedia! | direction = top left | alt text color = purple }}}}
gives: Шаблон:Large
Notice how the colors appear to be moving towards top left direction, in the same order as they appear on the template. This uses {{big}} for formatting. You can learn more about text formatting with this template at Text formatting section below.
  • The same color can also be repeated
{{Linear-gradient text | red | green | #0000ff | red | green | red | #0000ff | green | red | green | text = Abraham Lincoln was an American lawyer and statesman who served as the 16th president of the United States. | direction = right | alt text color = purple }}
gives: Abraham Lincoln was an American lawyer and statesman who served as the 16th president of the United States.
Notice how the colors appear to be moving towards right direction, first red, then green, then blue, then red again, green again, red again, blue again, green again, red again, and finally green again, in the same order as they appear on the template.
  • If the template does not contain the text parameter in it, it returns a default error message.
{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | direction = right | alt text color = purple }}
gives: Error message when text parameter is missing: No text provided
  • If the template does not contain the direction parameter in it, it defaults to right direction.
{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Welcome to Wikipedia! | alt text color = purple }}
gives: Welcome to Wikipedia!
  • If the template does not contain the alt text color parameter in it, it defaults to black color.
{{Linear-gradient text | red | text = Welcome to Wikipedia! }}
gives: Welcome to Wikipedia!
As mentioned above, atleast two font colors are required for this template to run properly, otherwise it will show up in the Alternate text color.

Text formatting

Note: In most cases, this template should be nested inside any other template and/or tag to avoid breaking. If formatting is carried out within the text parameter, the text may not appear as intended.

  • Шаблон:Bracket: Coloring wikilinks using this template is strongly discouraged, as it may cause the link to appear the same as other body texts. However, it can still be used in Userpages and other fun places.
[[Special:Random|{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Click here to read a random article | direction = right | alt text color = purple }}]]
gives: Click here to read a random article
  • Bold:
'''{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}'''
gives: Lorem ipsum dolor sit amet
  • Italic:
''{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}''
gives: Lorem ipsum dolor sit amet
  • Superscript:
<sup>{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}</sup>
gives: Lorem ipsum dolor sit amet
  • Subscript:
<sub>{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}</sub>
gives: Lorem ipsum dolor sit amet
  • Underline:
<u>{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}</u>
gives: Lorem ipsum dolor sit amet
  • Strikethrough:
<s>{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Lorem ipsum dolor sit amet | direction = right | alt text color = purple }}</s>
gives: Lorem ipsum dolor sit amet
  • Other text formatting, such as larger/ smaller text size should be done outside this template to avoid breaking at certain times. Here, the template {{big}} is used as an example, but is relevant to most other templates too.
{{big|{{Linear-gradient text | #ff99aa | #55ff00 | #7722ff | text = Welcome to Wikipedia! | direction = right | alt text color = purple }}}}
gives: Шаблон:Large

TemplateData

<templatedata> { "params": { "1": { "label": "Font color 1", "description": "First font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "2": { "label": "Font color 2", "description": "Second font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "3": { "label": "Font color 3", "description": "Third font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "4": { "label": "Font color 4", "description": "Fourth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "5": { "label": "Font color 5", "description": "Fifth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "6": { "label": "Font color 6", "description": "Sixth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "7": { "label": "Font color 7", "description": "Seventh font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "8": { "label": "Font color 8", "description": "Eighth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "9": { "label": "Font color 9", "description": "Ninth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "10": { "label": "Font color 10", "description": "Tenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "11": { "label": "Font color 11", "description": "Eleventh font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "12": { "label": "Font color 12", "description": "Twelfth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "13": { "label": "Font color 13", "description": "Thirteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "14": { "label": "Font color 14", "description": "Fourteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "15": { "label": "Font color 15", "description": "Fifteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "16": { "label": "Font color 16", "description": "Sixteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "17": { "label": "Font color 17", "description": "Seventeenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "18": { "label": "Font color 18", "description": "Eighteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "19": { "label": "Font color 19", "description": "Nineteenth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "20": { "label": "Font color 20", "description": "Twentieth font color", "type": "line", "suggestedvalues": [ "#000000" ] }, "alt text color": { "aliases": [ "23" ], "label": "Alternate text color", "description": "Color of text, if browser is unable to render the linear-gradient", "type": "line", "default": "black", "suggested": true }, "direction": { "aliases": [ "22" ], "label": "Direction", "description": "Direction of font color flow, i.e., the list of colors appear to be moving in that direction, see Examples above", "suggestedvalues": [ "right", "left", "top", "bottom", "top right", "top left", "bottom right", "bottom left", "30deg", "-60deg" ], "default": "right", "suggested": true, "type": "line" }, "text": { "aliases": [ "21" ], "label": "Text", "description": "The text that is to be shown", "type": "string", "default": "Error message when text parameter is missing: No text provided", "required": true } }, "paramOrder": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "text", "direction", "alt text color" ], "description": "Displays the specified text using multiple colors which gradually phases from one color to another." } </templatedata>

See Also