Difference between revisions of "Template:Hair color"
(暫時頁面,尚未校對.(the page which is still in edit)) |
m |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <!-- | + | <includeonly>{{#vardefine:preprocess |
− | < | + | |{{#if:{{#switch: {{Str_rightc|{{{1}}}|1}} <!-- If the last word of "hair color" matches one of the following --> |
− | ---- | + | |hair |
− | < | + | |color |
+ | = true }} | ||
+ | |{{Str_crop|{{{1}}}|1}} <!-- Then the last word is removed --> | ||
+ | |{{{1}}} <!-- Otherwise it is not --> | ||
+ | }} | ||
+ | }}<!-- | ||
− | + | -->{{#vardefine:hair color | |
+ | |{{#if:{{#switch: {{Str_left|{{#var:preprocess}}|1}} <!-- If the first word of “hair color”matches any of the following --> | ||
+ | |Light | ||
+ | |Dull | ||
+ | |Bright | ||
+ | |Dark | ||
+ | |Thick | ||
+ | |Thin | ||
+ | |Black | ||
+ | |Gray |Grey | ||
+ | |Silver | ||
+ | |Jade | ||
+ | = true }} | ||
+ | |{{#ifeq:{{Str_len|{{#var:preprocess}}}} | ||
+ | |1 <!-- And the length of “hair color” is longer than 1 word (to avoid cropping everything) --> | ||
+ | |{{#var:preprocess}} | ||
+ | |{{Str_crop_left|{{#var:preprocess}}|1}} <!-- Then the first word is cropped --> | ||
+ | }} | ||
+ | |{{#var:preprocess}} <!-- Otherwise it is not. --> | ||
+ | }} | ||
+ | }}<!-- | ||
− | + | -->{{#switch: {{#var:hair color}} | |
− | + | | Pink | |
− | + | | Brownish-pink | |
− | + | | Magenta | |
− | + | | Peachblow = [[Category:Pink hair]][[Pink hair|{{#var:preprocess}} hair]]<!-- The aim of using #var:preprocess is to preserve all possible prefixes --> | |
− | |- | + | | Crimson |
− | + | | Red | |
− | | | + | | Blood |Blood red = [[Category:Red hair]][[Red hair|{{#var:preprocess}} hair]] |
− | | Pink | + | | Purple |
− | | | + | | Indigo |
− | | Red||{{ | + | | Lilac |
− | | | + | | Mauve | Purplish red = [[Category:Purple hair]][[Purple hair|{{#var:preprocess}} hair]] |
− | | Purple | + | | Cyan |
− | | | + | | Blue |
− | | | + | | Sky blue = [[Category:Blue hair]][[Blue hair|{{#var:preprocess}} hair]] |
− | | | + | | Green |
− | | | + | | Olivine |
− | | | + | | Celadon |
− | | | + | | Blackish green = [[Category:Green hair]][[Green hair|{{#var:preprocess}} hair]] |
− | |- | + | | Golden |
− | + | | Blond | |
− | | | + | | Yellow |
− | | | + | | Gold |
− | + | | Beige | |
− | + | | Cream | |
− | + | | Flax | Flaxen = [[Category:Golden hair]][[Golden hair|{{#var:preprocess}} hair]] | |
− | | | + | | Orange |
− | + | | Tangerine = [[Category:Orange hair]][[Orange hair|{{#var:preprocess}} hair]] | |
− | + | | Brown | |
− | + | | Earth | |
− | <!-- | + | | Reddish brown |
− | + | | Maroon | |
− | <noinclude>[[Category: | + | | Linen brown |
+ | | Brownish black | ||
+ | | Tawny | ||
+ | | Khaki | ||
+ | | Claret | Wine red = [[Category:Brown hair]][[Brown hair|{{#var:preprocess}} hair]] | ||
+ | | Black | ||
+ | | Blue-black | Black-blue = [[Category:Black hair]][[Black hair|{{#var:preprocess}} hair]] | ||
+ | | White<!-- = [[Category:White hair]][[White hair|{{#var:preprocess}} hair]]--> | ||
+ | | Grey | ||
+ | | Silver | ||
+ | | Silvery gray | ||
+ | | Silvery white = [[Category:Silver hair]][[Silver hair|{{#var:preprocess}} hair]] | ||
+ | | Rainbow = [[Category:Rainbow hair]][[Rainbow hair|{{#var:preprocess}} hair]] | ||
+ | | Dual = [[Category:Dual-color hair]][[Dual-color hair|{{#var:preprocess}} hair]] | ||
+ | | Mixed | ||
+ | | Mixed-color = [[Category:Mixed-color hair]][[Mixed-color hair|{{#var:preprocess}} hair]] | ||
+ | | #default = <!-- Error-margin line, to accept "very narrowly-defined colors": | ||
+ | -->{{#vardefine:lastchar | ||
+ | |{{Str_right|{{#var:preprocess}}|{{#expr:{{Str_len|{{#var:preprocess}}}}-1}} }} <!-- Takes the last character of the string "x" --> | ||
+ | }}{{#ifexist: Category:{{#var:lastchar}}hair <!-- Detects whether "x hair" exists --> | ||
+ | | [[{{#var:lastchar}}hair|{{#var:preprocess}} hair]][[Category:{{#var:lastchar}}hair]] <!-- If there is a[[Category:x hair]], then it is displayed --> | ||
+ | | {{#var:preprocess}} hair[[Category:Incorrect hair color]] <!-- If not, it returns “Incorrect hair color” --> | ||
+ | }} | ||
+ | }}</includeonly><noinclude>{{Documentation}}[[Category:Auxiliary templates]]</noinclude> |
Latest revision as of 11:32, 26 August 2017
This template includes some very complex parameters and structures in its source code. This template has a complex structure. Please do not arbitrarily modify this template unless you are sure that you understand its use and details, and are capable of fixing all the changes entailing this edit. Please conduct all experimental steps in the sandbox or your own user page.Please refer to the discussion page before using. |
This template is used for hair-color related items on Galcharainfo-type templates.
It is made to automatically recognize and correct incorrect hair colors. Articles with wrongly-entered hair colors can be found at Incorrect hair color.
The hair colors mentioned here are divided into main types, with common derivatives automatically allocated to the main one. If some commonly-appearing secondary colors exist, they can be added into the template.
Current table of Colors
Category | Primary | Secondary |
---|---|---|
Pink | #FFC0CB | Magenta #FF00FF |
Red | #FF0000 | |
Purple | #800080 | Indigo #4B0080 |
Blue | #0000FF | Cyan #00FFFF |
Green | #00FF00 | Yellowish Green #9ACD32, Celadon(Pale Green) #98FB98, Dark Green #006400 |
Blond | #FFD700 | Yellow #FFFF00, Flax/Flaxen #FAF0E6, Beige #E3CCA9 |
Orange | #FFA500 | |
Earth | #964B00 | Brown #A52A2A, Maroon #800000, Claret #852839 Coffee #4D3900, Tawny #654321 |
Black | #000000 | |
Silver | #C0C0C0 | Grey #808080, White #FFFFFF |
Rainbow |