Template:Highlight Gradient: Difference between revisions

From Ludlow Family Wiki
Jump to navigation Jump to search
(Created page with "<noinclude>Generate a CSS gradient for the given list of colors. The result includes a zone for each color followed by an equally-sized transition zone to the next color. * F...")
 
No edit summary
Line 1: Line 1:
<noinclude>Generate a CSS gradient for the given list of colors.  The result includes a zone for each color followed by an equally-sized transition zone to the next color.
<noinclude>Generate a CSS background for the given list of colors.  For an empty list, the result is "transparent"; for a single element, the result is that color; for multiple elements, the result is a gradient.  The gradient includes a zone for each color followed by an equally-sized transition zone to the next color.
* First parameter: a semicolon-delimited list of CSS colors
* First parameter: a semicolon-delimited list of CSS colors
* ''direction'': direction for gradient; default is "to right"
* ''direction'': direction for gradient; default is "to right"
</noinclude><includeonly>{{#if:{{{1}}}
</noinclude><includeonly>{{#if:{{{1}}}
| linear-gradient({{#if:{{{direction|}}}|{{{direction}}}|to right}}, {{For Each|{{{1}}}|;|, |
| {{#explode:{{{1}}}|;|0}} {{#if: {{#if: {{#explode:{{{1}}}|;|1}}
  | template=Highlight Gradient/Step
  | linear-gradient({{#if:{{{direction|}}}|{{{direction}}}|to right}}, {{For Each|{{{1}}}|;|, |
  | param={{#expr: 100 / ({{List Size|{{{1}}}|;}} * 2 - 1)}}
    | template=Highlight Gradient/Step
   }})
    | param={{#expr: 100 / ({{List Size|{{{1}}}|;}} * 2 - 1)}}
    }})
   }}
| transparent
}}</includeonly>
}}</includeonly>

Revision as of 11:23, 25 June 2015

Generate a CSS background for the given list of colors. For an empty list, the result is "transparent"; for a single element, the result is that color; for multiple elements, the result is a gradient. The gradient includes a zone for each color followed by an equally-sized transition zone to the next color.

  • First parameter: a semicolon-delimited list of CSS colors
  • direction: direction for gradient; default is "to right"