Thread Tools Display Modes
07/17/14, 11:41 AM   #1
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Colored Addon Titles

Two questions I thought I'd find answered somewhere, but haven't.

1. Has it been pointed out to ZOS that they should sort addon titles (in addon enabling page) stripped from markup? I hate it when Guild Search Store (blue) precedes BestFriends (purple) because of the color. They're also cutting the string length disrespecting markup, so if you have an icon with long filename, they break it in the middle, and you get white rectangle instead.

2. If they're not going to fix it, do you think it's possible to establish a convention that would make specially titled addons sort correctly by a few initial characters at least? The trick would be to (ab)use the |c escape - put a sorting key to it instead of hexcolor (the parser doesn't care) - and place it before the desired color. Like this:
Code:
Title: |cBestFr|c9966ffBestFriends (example)
  Reply With Quote
07/17/14, 12:30 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
If it is enough to have sorted ingame addons list:
Lua Code:
  1. ZO_PreHook(ZO_AddOnManager, "SortScrollList",
  2.    function(self)
  3.       local scrollData = ZO_ScrollList_GetDataList(self.list)
  4.  
  5.       local function SortEntries(entry1, entry2)
  6.          local value1 = (entry1.data.addOnName):gsub("|c%w%w%w%w%w%w", ""):gsub("|r", ""):lower()
  7.          local value2 = (entry2.data.addOnName):gsub("|c%w%w%w%w%w%w", ""):gsub("|r", ""):lower()
  8.  
  9.          if value1 == value2 then
  10.             return (entry1.data.addOnFileName):lower() < (entry2.data.addOnFileName):lower()
  11.          else
  12.             return value1 < value2
  13.          end
  14.       end
  15.       table.sort(scrollData, SortEntries)
  16.  
  17.       return true
  18.    end)
Warning: Spoiler
  Reply With Quote
10/13/14, 06:26 PM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Addon manager on PTS 1.5.0 removes color codes for sorting purposes:

EsoUI\Common\ZO_AddOnManager\ZO_AddOnManager.lua, line 413:
Lua Code:
  1. local addOnSortName = title:gsub("|c%x%x%x%x%x%x", "")
  Reply With Quote
10/14/14, 04:32 AM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Nice, glad I abandoned the hacky idea in 2. Btw, does it remove |texture tags, too?
  Reply With Quote
10/14/14, 05:40 AM   #5
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by merlight View Post
Nice, glad I abandoned the hacky idea in 2. Btw, does it remove |texture tags, too?
No, it removes only color start tag |c??????, nothing else.
  Reply With Quote
10/14/14, 08:31 AM   #6
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Is texture markup commonly used in add-on titles? I could push to add some code for this release to strip that off the front as well if you all think it would be worthwhile.
  Reply With Quote
10/14/14, 09:08 AM   #7
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by ZOS_ChipHilseberg View Post
Is texture markup commonly used in add-on titles? I could push to add some code for this release to strip that off the front as well if you all think it would be worthwhile.
No, I have never seen anything else then color codes in addon title. But if you want to break sorting on purpose - for example if you want your addon listed first, you can come up with this method.
  Reply With Quote
10/14/14, 10:31 AM   #8
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by ZOS_ChipHilseberg View Post
Is texture markup commonly used in add-on titles? I could push to add some code for this release to strip that off the front as well if you all think it would be worthwhile.
No, haven't seen any. I tried using it in one of my unreleased addons, purely out of curiosity, and I actually placed it after the title. As markup is not handled specially, it takes up precious character space, and is prone to being broken in half. So it's probably not worth removing it for sorting, without much more complex handling for display - reading texture width instead of string width for truncation. If anything, there could be a special "favicon" manifest directive and column for icons.

But I have another request more related to the original topic. Some addons have the whole title colored (sometimes in multiple colors), preventing them from being dimmed when they're disabled. Could you add some kind of darkening to disabled addon titles? Like this:

Lua Code:
  1. local function dimColor(r, g, b)
  2.     local dr = 0.6 * tonumber(r, 16)
  3.     local dg = 0.6 * tonumber(g, 16)
  4.     local db = 0.6 * tonumber(b, 16)
  5.     return string.format("|c%02x%02x%02x", dr, dg, db)
  6. end
  7. local dimmedTitle = title:gsub("|c(%x%x)(%x%x)(%x%x)", dimColor)

Last edited by merlight : 10/14/14 at 10:33 AM.
  Reply With Quote
10/14/14, 04:31 PM   #9
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
The add-on list will now only show color markup when the add-on is enabled. The other cases will show the disabled or error colors. Hopefully we can get it into this coming update.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Colored Addon Titles


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