pythonrenpy

Renpy python variable text color


I started making a novel and learn renpy really recently, and I came across a difficulty that I couldn't find the solution. I put an input for the user to define the name of the protagonist, but when I declare the character, the color that I designated to appear in the text box is not working.

Here a piece of my code:

python:
    sn = ""

define luca =   Character("     Luca Kaneshiro", color="#ffffff")
define sn =     Character("%(sn)s", color="#ffffff")

label start:
    call askname

    luca "Hey %(sn)s."
    sn "Hi, Luca!"

label askname:
    $ sn = renpy.input("What's my name?", length=32)

here's how the text in displayed

enter image description here

I was expecting it to be displayed in white color, but instead it was displayed in yellow, the collor that I defined for gui.accent_color. Is there any solution for that? A way to turn the text in the sn variable into a normal text or something like this?


Solution

  • According to Renpy's documentation on Character, you need to attached a who_style arguments, specifically who_color in this case:

    define sn = Character("%(sn)s", who_color="#ffffff")
    

    Also, unrelated but renpy doc uses square bracket for string/text interpolation instead, so in case the above doesn't work, try the following:

    define sn = Character("[sn]", who_color="#ffffff")