Colors for Individual Characters

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
GeekBone
Newbie
Posts: 3
Joined: Tue Sep 17, 2019 12:24 pm
Deviantart: geekbone
Contact:

Colors for Individual Characters

#1 Post by GeekBone »

I want to have different text colors for character situations. For example, character MC has standard text and colors when talking, but when they are thinking, I would like to have different colors and italics. I can obviously do it inline, but I would like to not have to enter all of that info each time.

I started by thinking I could have different variable for each character. For example, MC would have standard text and colors, but MCT would have a different color and characteristics.

Currently, I am thinking I could use a style, but I have been struggling with that as well.

Any suggestions?

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

Re: Colors for Individual Characters

#2 Post by Ocelot »

Code: Select all

# You can supply style properties to the name (with 'who_' prefix)
# and to text itself (with 'what_' prefix)
define C1 = Character("Character2", who_color="#F00", what_color="#F55")
define C2 = Character("Character2", who_color="#0F0", what_color="#5F5")

# You can define function returning new character objects if you need to apply
# uniform modification to all characters
init python:
    def think(char):
        return Character(kind=char, what_italic=True)


label start:

    C1 "Hello"
    C2 "Hello"
    think(C1) "I do not like him"
    
    return
< < insert Rick Cook quote here > >

GeekBone
Newbie
Posts: 3
Joined: Tue Sep 17, 2019 12:24 pm
Deviantart: geekbone
Contact:

Re: Colors for Individual Characters

#3 Post by GeekBone »

Perfect! Thanks!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]