ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Formating & Colouring Titles (https://www.esoui.com/forums/showthread.php?t=10191)

Masteroshi430 05/26/22 11:55 PM

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

Baertram 05/27/22 01:25 PM

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.


All times are GMT -6. The time now is 05:11 PM.

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