Editing Module:Utilities/docGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 1: | Line 1: | ||
=Overview= | |||
Utility functions that serve any miscellaneous purpose | Utility functions that serve any miscellaneous purpose | ||
=Functions= | |||
==get_slot_color== | ==get_slot_color== | ||
Retrieve's the color of a certain slot/category | 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. | ||
===Parameters=== | ===Parameters=== | ||
* '''slot''' - slot key, options are Weapon, Armor, and Tech | * '''slot''' - slot key, options are Weapon, Armor, and Tech | ||
* '''color_format''' - color format | * '''color_format''' - color format, defaults to hex. Valid options are hex, rgb, hsl, cmyk | ||
* '''no_wrap''' | * '''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 | ||
* '''debug_mode''' - (OPTIONAL) - | * '''debug_mode''' - (OPTIONAL) - used mostly for documentation purposes | ||
===Examples=== | ===Examples=== | ||
To retrieve the color alone | |||
<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}} | |||
{{#invoke:Utilities| | 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> | |||
{{#invoke:Utilities| | <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> | |||