Hex variable and color

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Thundy
Regular
Posts: 88
Joined: Tue Dec 05, 2017 9:08 am
Contact:

Hex variable and color

#1 Post by Thundy »

Hey all. Another annoying question here.

Im trying to set the color of some text based on the value of a variable but the various permutations of this that i have tried throw exceptions

basically i want to set a variable elsewhere in the code which will allow me to use text color flag i.e

$ textColorVar = "#ffaa00"

text "{color = textColorVar} Text n stuff {/color}"

for clarity i have already tried the above and it doesn't work. it says that color string must be 3,4, 6 or 8 characters long

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2401
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Hex variable and color

#2 Post by Ocelot »

Use string substitution to insert your string into text: text "{color=[textColorVar]} Text n stuff {/color}"
< < insert Rick Cook quote here > >

Thundy
Regular
Posts: 88
Joined: Tue Dec 05, 2017 9:08 am
Contact:

Re: Hex variable and color

#3 Post by Thundy »

Thanks Ill give that a try :D

Post Reply

Who is online

Users browsing this forum: No registered users