Howto: keep color in replace()

Post Reply
User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Howto: keep color in replace()

Post by Vadi »

To keep colour in your replace(), just add this inbetween your select and replace functions:
Code: [show] | [select all] lua
  setBgColor(getBgColor())
  setFgColor(getFgColor())
For example, what was
Code: [show] | [select all] lua
selectString("Bob", 1)
replace("Bob the guy")
Now becomes
Code: [show] | [select all] lua
selectString("Bob", 1)
setBgColor(getBgColor())
setFgColor(getFgColor())
replace("Bob the wizard")

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: Howto: keep color in replace()

Post by Rakon »

What about lines that have different colours in them??

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Howto: keep color in replace()

Post by Vadi »

Then this isn't applicable. If you'll be adding new text, how will a script know what colours to apply to the new wording?

Post Reply