Module:Utilities/doc: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
m more color examples for no_wrap
Sur (talk | contribs)
m moving examples to SlotColor
 
Line 5: Line 5:


==get_slot_color==
==get_slot_color==
Retrieve's the hex color of a certain slot/category, formerly known in english as Weapon, Vitality, and Spirit, though their unlocalized names are Weapon, Armor, and Tech.
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. Utilized by [[Template:SlotColor]]


===Parameters===
===Parameters===
* '''slot''' - slot key, options are Weapon, Armor, and Tech
* '''slot''' - slot key, options are Weapon, Armor, and Tech
* '''color_format''' - color format, defaults to hex. Valid options are hex, rgb, hsl, cmyk
* '''color_format''' - color format - Defaults to hex. Valid options are hex, rgb, hsl, cmyk
* '''no_wrap''' - 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
* '''no_wrap''' - (OPTIONAL) - 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
* '''debug_mode''' - (OPTIONAL) - used mostly for documentation purposes
* '''debug_mode''' - (OPTIONAL) - Defaults to false. Used mostly for documentation purposes


===Examples===
===Examples===
To retrieve the color alone
See examples at [[Template:SlotColor]]
<code><nowiki>{{#invoke:Utilities|get_slot_color|Tech}}</nowiki></code>
 
{{#invoke:Utilities|get_slot_color|Tech|debug_mode=true}}
 
To retrieve other color formats
<code><nowiki>{{#invoke:Utilities|get_slot_color|Tech|rgb}}</nowiki></code>
 
{{#invoke:Utilities|get_slot_color|Tech|rgb|debug_mode=true}}
 
 
To style text:
<code><nowiki><span style="color: {{#invoke:Utilities|get_slot_color|Weapon}};">Weapon colored text</span></nowiki></code>
 
<span style="color: {{#invoke:Utilities|get_slot_color|Weapon}};">Weapon colored text</span>
 
 
To style divs:
<code><nowiki><div style="background-color: {{#invoke:Utilities|get_slot_color|Tech}};">
Tech colored div</div></nowiki></code>
 
<div style="background-color: {{#invoke:Utilities|get_slot_color|Tech}};">
Tech colored div
</div>
 
 
To get the color without otherwise necessary prefix/postfix wrapping:
 
<code><nowiki>{{#invoke:Utilities|get_slot_color|Tech|rgb|no_wrap=true}}</nowiki></code>
 
{{#invoke:Utilities|get_slot_color|Tech|rgb|no_wrap=true|debug_mode=true}}
 
 
To alter the alpha value using rgb dynamically:
<code><nowiki><div style="background-color: rgb({{#invoke:Utilities|get_slot_color|Armor|rgb|no_wrap=true}}, 1.0);">
Armor colored div with 1.0 alpha</div></nowiki></code>
 
<div style="background-color: rgb({{#invoke:Utilities|get_slot_color|Armor|rgb|no_wrap=true}}, 1.0);">
Armor colored div with 1.0 alpha
</div>
 
 
 
<code><nowiki><div style="background-color: rgb({{#invoke:Utilities|get_slot_color|Armor|rgb|no_wrap=true}}, 0.2);">
Armor colored div with 0.2 alpha</div></nowiki></code>
 
<div style="background-color: rgb({{#invoke:Utilities|get_slot_color|Armor|rgb|no_wrap=true}}, 0.2);">
Armor colored div with 0.2 alpha
</div>

Latest revision as of 22:47, 1 November 2024

Overview[edit source]

Utility functions that serve any miscellaneous purpose

Functions[edit source]

get_slot_color[edit source]

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. Utilized by Template:SlotColor

Parameters[edit source]

  • 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) - 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
  • debug_mode - (OPTIONAL) - Defaults to false. Used mostly for documentation purposes

Examples[edit source]

See examples at Template:SlotColor