Page 1 of 1

How can I add a visible highlight to dialogue text?

Posted: Sat Jul 14, 2018 2:58 pm
by CrowdControlHS
A few of my characters are meant to speak with a colored highlight to their text, like you could add to text in a Google Doc. How can I do this in Ren'Py? Preferably, I would like to know how to attach a string of code to the characters themselves that would add a highlight to everything they say automatically (like how you can assign the color of the character's name.) Thank you.

P.S. I'll also add that I'm not talking about outlining text, in case there's any confusion.

Re: How can I add a visible highlight to dialogue text?

Posted: Sat Jul 14, 2018 6:11 pm
by MaydohMaydoh
Don't think there is a way to do it, but you could edit the say screen and put the "what" text into a frame which gets a background color from a dictionary.

Code: Select all

define saycolors = { "Frank" : "#ff0000", "Sara" : "#00ff00" }
define frank = Character("Frank")
define sara = Character("Sara")
You have to make sure the names in the dictionary are the same as the characters' names in Character.

Code: Select all

frame xfill False:
	if who in saycolors.keys():
		background saycolors[who]
	else:
		background None
	text what id "what"
Then you put the "what" text in the say screen inside a frame. The if statement then checks if the name is in the dictionary and if it is then it applies the background color relating to the dictionary entry to the frame. Then you can mess around with the frame's style to get it just right.
Of course it's not perfect as if you have more than one line and the line stops half way, you'll get empty space with the background color.