Template:SlotColor/doc

From Deadlock Wiki
Revision as of 22:55, 1 November 2024 by Sur (talk | contribs) (clarified that no_wrap is named parameter; clarified the no_wrap example's usage of alpha channel)
Jump to navigation Jump to search

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}}

This template has been marked for deletion.
Reason: moved to Template:Color

To retrieve other color formats {{SlotColor|Tech|rgb}}

This template has been marked for deletion.
Reason: moved to Template:Color


To style text: <span style="color: {{SlotColor|Weapon}};">Weapon colored text</span>

<span style="color:

This template has been marked for deletion.
Reason: moved to Template:Color

;">Weapon colored text


To style divs: <div style="background-color: {{SlotColor|Tech}};"> Tech colored div</div>

<div style="background-color:

This template has been marked for deletion.
Reason: moved to Template:Color

;">

Tech colored div


To get the color without otherwise necessary prefix/postfix wrapping:

{{SlotColor|Tech|rgb|no_wrap=true}}

This template has been marked for deletion.
Reason: moved to Template:Color

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(

This template has been marked for deletion.
Reason: moved to Template:Color

, 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(

This template has been marked for deletion.
Reason: moved to Template:Color

, 0.5);">

Armor colored div with 0.5 alpha