(Done)How to change the choice menu text 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
edouardlicn
Regular
Posts: 57
Joined: Tue Feb 05, 2013 8:19 pm
Projects: April
Contact:

(Done)How to change the choice menu text color?

#1 Post by edouardlicn »

Code: Select all

    style.menu_choice_text.hover_color = "#ffffff"
    style.menu_choice_text.idle_color = "#eaeaea"

Why codes above don't work.
Last edited by edouardlicn on Tue Sep 03, 2013 3:58 am, edited 2 times in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How to change the choice menu text color?

#2 Post by Alex »

Should be

Code: Select all

style.menu_choice.hover_color = "#ffffff"
style.menu_choice.idle_color = "#eaeaea"

edouardlicn
Regular
Posts: 57
Joined: Tue Feb 05, 2013 8:19 pm
Projects: April
Contact:

Re: How to change the choice menu text color?

#3 Post by edouardlicn »

no,it dosen't work.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How to change the choice menu text color?

#4 Post by Alex »

Hm, where did you put this code?
Try to add this lines at the end of init python block that is right after choice screen in screens.rpy. If it wouldn't work, then show the code you have to let people find the problem.

edouardlicn
Regular
Posts: 57
Joined: Tue Feb 05, 2013 8:19 pm
Projects: April
Contact:

Re: How to change the choice menu text color?

#5 Post by edouardlicn »

I have post it on that place.

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: How to change the choice menu text color?

#6 Post by Elmiwisa »

The code you have merely produce a style called menu_choice_text. Producing a style is not enough, you need to actually use it. Have you wrote the code to use it?

edouardlicn
Regular
Posts: 57
Joined: Tue Feb 05, 2013 8:19 pm
Projects: April
Contact:

Re: How to change the choice menu text color?

#7 Post by edouardlicn »

Code: Select all

##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5
        
        vbox:
            style "menu"
            spacing 2
            
            for caption, action, chosen in items:
                
                if action:  
                    
                    button:
                        action action
                        style "menu_choice_button"                        

                        text caption style "menu_choice"
                    
                else:
                    text caption style "menu_caption"

init -2 python:
    config.narrator_menu = True
    

    style.menu_choice.hover_color = "#ffffff"
    style.menu_choice.idle_color = "#eaeaea"
    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.55)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.55)
    
    style.menu_choice_button.background = Frame("ui/choice_bg_idle.png",28,9)
    style.menu_choice_button.hover_background = Frame("ui/choice_bg_hover.png",28,9)

And you can see what happen here http://pan.baidu.com/share/link?shareid ... 3172121467

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: How to change the choice menu text color?

#8 Post by Elmiwisa »

Oh I see, so you put these line in the wrong position.
Notice this line:

Code: Select all

    style.menu_choice.clear()
This line clear all the attribute from the style, undoing any changes you made to it before that point, as stated here http://www.renpy.org/doc/html/style.html#Style.clear

Thus you need to put your code AFTER this line, as follow:

Code: Select all

init -2 python:
    config.narrator_menu = True
   

    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)

    style.menu_choice.clear()                             #any changes need to be made after this line
    style.menu_choice.hover_color = "#ffffff"         #here is your code
    style.menu_choice.idle_color = "#eaeaea"

    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.55)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.55)
   
    style.menu_choice_button.background = Frame("ui/choice_bg_idle.png",28,9)
    style.menu_choice_button.hover_background = Frame("ui/choice_bg_hover.png",28,9)

edouardlicn
Regular
Posts: 57
Joined: Tue Feb 05, 2013 8:19 pm
Projects: April
Contact:

Re: How to change the choice menu text color?

#9 Post by edouardlicn »

ok,it fixed

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]