Module:Utilities/doc

Revision as of 22:35, 1 November 2024 by Sur (talk | contribs) (more color examples for no_wrap)

This is the documentation page for Module:Utilities

Overview

Utility functions that serve any miscellaneous purpose

Functions

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.

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

Examples

To retrieve the color alone {{#invoke:Utilities|get_slot_color|Tech}}

#c288f0

To retrieve other color formats {{#invoke:Utilities|get_slot_color|Tech|rgb}}

rgb(194,136,240)


To style text: <span style="color: {{#invoke:Utilities|get_slot_color|Weapon}};">Weapon colored text</span>

Weapon colored text


To style divs: <div style="background-color: {{#invoke:Utilities|get_slot_color|Tech}};"> Tech colored div</div>

Tech colored div


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

{{#invoke:Utilities|get_slot_color|Tech|rgb|no_wrap=true}}

194,136,240


To alter the alpha value using rgb dynamically: <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>

Armor colored div with 1.0 alpha


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

Armor colored div with 0.2 alpha