Template:Ink chip: Difference between revisions

From stencil.wiki
No edit summary
No edit summary
Line 15: Line 15:
</pre>
</pre>
{{Color chip|Yellow|link=Violet}}  
{{Color chip|Yellow|link=Violet}}  
</noinclude>


=== Test Area ===
<includeonly><span class="chip color-chip text-{{#ifexpr:
 
{{#rmatch:
{{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$1|}}
{{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$2|}}
{{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$3|}}
 
{{#invoke:Color|rgbTripletToHex|
  {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$1|}}
| {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$2|}}
| {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$3|}}
}}
 
{{#invoke:Color|hexToHsv|
{{#invoke:Color|hexToHsv|
{{#invoke:Color|rgbTripletToHex|
{{#invoke:Color|rgbTripletToHex|
Line 35: Line 26:
}}
}}
}}
}}
 
|/([0-9]{1,3})%$/|$1}}
{{#rmatch:{{#invoke:Color|hexToHsv|
>50|white|black}}" style="background:rgba({{#show: {{{1}}} |? Has rgb#}},1);border-color:rgba({{#show: {{{1}}} |? Has rgb#}},1);">[[{{{link|{{{1|}}}}}}|{{{1|}}}]]</span></includeonly>
{{#invoke:Color|rgbTripletToHex|
  {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$1|}}
| {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$2|}}
| {{#rmatch:145,78,114|/^([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3})$/|$3|}}
}}
}}|/([0-9]{1,3})%$/|$1}}
 
</noinclude>
 
<includeonly><span class="chip color-chip text-{{#switch:{{lc:{{{1}}}}}
| mint = black
| light lime = black
| yellow = black
| fluorescent yellow = black
| sunflower = black
| melon = black
| light mauve = black
| bisque = black
| mist = black
| white = black
| clear medium = black
| #default = {{{text|white}}}
}}" style="background:rgba({{#show: {{{1}}} |? Has rgb#}},1);border-color:rgba({{#show: {{{1}}} |? Has rgb#}},1);">[[{{{link|{{{1|}}}}}}|{{{1|}}}]]</span></includeonly>

Revision as of 19:54, 3 December 2024

A template to display ink colors as chips.

Usage

{{Color chip|Violet}}

Template:Color chip

Advanced attributes

Sometimes you will need the chip to point to a link other than the title, you can use that buy adding the link attribute:

{{Color chip|Yellow|link=Violet}}

Template:Color chip