Template:Color

explain xkcd: It's 'cause you're dumb.
Jump to navigation Jump to search

Applies a text color using either a standard CSS color value or a preset from Template:Color/custom.

Usage

For a standard static color (color name, hex code, or RGB value):

{{Color|COLOR|TEXT}}

For a custom preset (leave the first parameter blank; defaults to Set 1):

{{Color||TEXT|PRESET}}

To specify a different set from {{Color/custom}}:

{{Color||TEXT|PRESET|SET}}
{{Color||TEXT|PRESET|set=SET}}
  • 1 — Any valid CSS color (e.g., SeaGreen, #57A0C4). Ignored if parameter 3 is provided.
  • 2 — The text to color.
  • 3 — Optional preset ID from {{Color/custom}}. Overrides parameter 1 when present.
  • 4 / set — Optional set ID from {{Color/custom}}. Defaults to 1.

Examples

Static colors

{{Color|SeaGreen|This text is sea green.}}
Produces:
This text is sea green.
{{Color|#D60270|This text uses a hex code.}}
Produces:
This text uses a hex code.

Custom presets (Set 1)

{{Color||One|1}} {{Color||two|2}} {{Color||three|3}} {{Color||four|4}} {{Color||five|5}}
Produces (updates daily):
One two three four five

Edge cases and caching

Case Input Output Behavior
Override precedence {{Color|red|Text|1}} Text Parameter 3 takes priority over parameter 1.
Invalid preset ID {{Color||Text|99}} Text Defaults to color:inherit so surrounding text color is preserved.
Missing color {{Color||Text}} Text Outputs an empty style="color:" attribute (renders as normal text).
  • Page caching: Because preset colors rotate based on the server's day of the year, an article may continue showing the previous day's colors until MediaWiki's parser cache refreshes or the page is purged (?action=purge).