Template:WrapCssVariableIfNeeded

From Cosmoteer Wiki
Jump to navigation Jump to search

{{{1}}}

Examples

{{WrapCssVariableIfNeeded|red}}
red

{{WrapCssVariableIfNeeded|--color-blue}}
var(--color-blue)

{{WrapCssVariableIfNeeded|#123456}}

  1. 123456

(converts to an ordered list, since wiki uses # as a list marker)

Checks if the given string looks like a CSS variable. If so, wraps it in «var()» syntax, making it possible to use as CSS color value. Otherwise (if a string is not a css variable), returns it «as is».

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
String1

String to check.

Example
red, --color-blue, #123456
Stringrequired