Template:SlotColor/doc
Retrieve's the color of a certain slot/category in any color format (default hex), formerly known in english as Weapon, Vitality, and Spirit, though their unlocalized names are Weapon, Armor, and Tech. Utilizes Module:Utilities's get_slot_color
function.
Parameters
- slot - slot key, options are Weapon, Armor, and Tech
- color_format - color format - Defaults to hex. Valid options are hex, rgb, hsl, cmyk
- no_wrap - (OPTIONAL, Named parameter) - Defaults to false. Set to true to remove prefixes and postfixes of '#' from hex, or 'rgb()', 'hsl()', and 'cmyk()' from the other formats. May be useful for altering the values dynamically
Examples
To retrieve the color alone
{{SlotColor|Tech}}
To retrieve other color formats
{{SlotColor|Tech|rgb}}
To style text:
<span style="color: {{SlotColor|Weapon}};">Weapon colored text</span>
<span style="color:
;">Weapon colored text
To style divs:
<div style="background-color: {{SlotColor|Tech}};">
Tech colored div</div>
<div style="background-color:
;">
Tech colored div
To get the color without otherwise necessary prefix/postfix wrapping:
{{SlotColor|Tech|rgb|no_wrap=true}}
This can manually be wrapped like rgba({{SlotColor|Tech|no_wrap=true}}, 0.5)
to customize the alpha channel (opacity/transparency) of the color to your liking. Note that with transparency, the color will vary on light or dark mode, so consider adding a white/black background behind to enforce consistency.
To alter the alpha value using rgb dynamically:
<div style="background-color: rgba({{SlotColor|Armor|rgb|no_wrap=true}}, 1.0);">
Armor colored div with 1.0 alpha</div>
<div style="background-color: rgba(
, 1.0);">
Armor colored div with 1.0 alpha
<div style="background-color: rgba({{SlotColor|Armor|rgb|no_wrap=true}}, 0.5);">
Armor colored div with 0.5 alpha</div>
<div style="background-color: rgba(
, 0.5);">
Armor colored div with 0.5 alpha