ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   Icon and Texture tinting in Addons (https://www.esoui.com/forums/showthread.php?t=8312)

Baumkuchen3 01/30/19 05:45 PM

Icon and Texture tinting in Addons
 
I've seen a few addons which obviously tint some of their used icons.

How does this work "zo_iconFormat(...)"?

sirinsidiator 01/30/19 05:56 PM

zo_iconFormatInheritColor is your friend. Just use the |c format in front of it.

Baumkuchen3 01/31/19 05:44 AM

Great, now it works. Here is an example for other people:


Code:

Label:SetText(string.format("|cFF0000%s|r", zo_iconFormatInheritColor(texturePath, textureSize, textureSize)))


Additional information:
Text_Formatting_Examples

Thank you.

sirinsidiator 01/31/19 06:12 AM

In addition you can use ZO_ColorDef in order to simplify the handling of everything related to colors. Your example would then look like this:
Lua Code:
  1. local myIcon = zo_iconFormatInheritColor(texturePath, textureSize, textureSize)
  2. local MY_COLOR = ZO_ColorDef:New("FF0000")
  3. label:SetText(MY_COLOR:Colorize(myIcon))
There are also a lot of predefined colors used by the game. You can find them in defaultcolordefs.lua.

p.s. in Lua you'd typically use lower_case or camelCase names for regular variables and ALL_CAPS for constants. Only classes or (at least in ESO) functions should use an uppercase letter.


All times are GMT -6. The time now is 11:39 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI