Templat:Party color
Kokitanan
This template is used on approximately 64,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Template:Party color produces the hexadecimal color of the provided political party.
Usage
[simbanai toud]{{Party color|<party name>}}
Parameters
[simbanai toud]Parameter | Description |
---|---|
1 | The political party's name. If a party is not found, place a request at the talk page. |
error | Optional, this parameter will return the provided |error= value if the module does not contain the requested party or color.
|
Examples
[simbanai toud]Here are some examples using the Labour Party (note that there are multiple potential input names):
["Labour and Co-operative"] = "Labour Party (UK)",
["Labour Co-operative"] = "Labour Party (UK)",
...
["Labour Party (Thailand)"] = {abbrev = "", color = "#000000", shortname = "",},
["Labour Party (UK)"] = {abbrev = "Lab", color = "#E4003B", shortname = "Labour",},
{{Party color|Labour Party (UK)}}
→ #E4003B{{Party color|Labour and Co-operative}}
→ #E4003B{{Party color|Labour Co-operative}}
→ #E4003B
Error messages
[simbanai toud]If the party is not supplied, or the color is not stored for the party, an error will be returned. Note that if the party is not in the module at all (third example below) the default color #F8F9FA will be returned.
{{Party color}}
→ parameter 1 should be a party name.{{Party color|A test no values}}
→ Ralat Lua pada baris 80 di package.lua: module 'Module:Political party/A' not found.{{Party color|Not-a-party}}
→ Ralat Lua pada baris 80 di package.lua: module 'Module:Political party/N' not found.
To avoid generating a script error, use |error=value
. Note that this error value will also be passed if the party is not stored in the module.
{{Party color|A test no values|error=ERROR}}
→ Ralat Lua pada baris 80 di package.lua: module 'Module:Political party/A' not found.{{Party color|Not-a-party|error=ERROR}}
→ Ralat Lua pada baris 80 di package.lua: module 'Module:Political party/N' not found.