Thread Tools Display Modes
05/26/22, 11:55 PM   #1
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Formating & Colouring Titles

Hi all,
So, I have problems with pronouns not in the same colour I set the text, that's probably because if you set the color inside zo_strformat the pronoun is added after the colour is set to the original text.

I have this problem when I use:

Lua Code:
  1. self.mapTitle:SetText(zo_strformat("|cffffff<<1>>|r",mapTitleName))

I can solve it by using :

Lua Code:
  1. self.mapTitle:SetText( string.format("|cffffff"..zo_strformat(mapTitleName).."|r"))

... But is there a cleaner way to do this ?

EDIT:
I thought this would work but ^f ^F... are not formatted so here's no pronoun anymore...
Lua Code:
  1. self.mapTitle:SetText(zo_strformat("|cffffff"..mapTitleName.."|r"))

Wiki page on zo_strformat for reference for addon authors with a similar problem :
https://wiki.esoui.com/How_to_format...h_zo_strformat

Last edited by Masteroshi430 : 05/27/22 at 01:47 AM.
  Reply With Quote
05/27/22, 01:25 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Why not simply using self.mapTitle:SetText("|cffffff".. zo_strformat(SI_UNIT_NAME, mapTitleName) .."|r") so that the map title will be formatted and get's the ^f etc. removed, and the color will be around "all text" then.

SI_UNIT_NAME is just an example, it relates to <<1>> in en and <<C:1>> for capital first char in de e.g.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Formating & Colouring Titles

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