Thread Tools Display Modes
01/30/19, 05:45 PM   #1
Baumkuchen3
AddOn Author - Click to view addons
Join Date: Jan 2019
Posts: 12
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(...)"?
  Reply With Quote
01/30/19, 05:56 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
zo_iconFormatInheritColor is your friend. Just use the |c format in front of it.
  Reply With Quote
01/31/19, 05:44 AM   #3
Baumkuchen3
AddOn Author - Click to view addons
Join Date: Jan 2019
Posts: 12
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.
  Reply With Quote
01/31/19, 06:12 AM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
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.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Icon and Texture tinting in Addons

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off