[solved] SetField action not changing persistent color variable
Posted: Fri Dec 22, 2017 4:52 am
I have a pretty simple black-on-white interface, but I realized it could get a little hard on the eyes. so I'm trying to make two themes, one a default "light mode" and one "dark mode" that changes the color of the text and background.
first, I changed some stuff so the gui could be controlled by just a few variables:
gui.rpyscreens.rpy
then I added a new set of buttons in the Preferences screen:
but it doesn't work. is it because it's a persistent color variable? or am I missing something?
(I also found something about Style Preferences, but I think it might be outdated - either that or I didn't implement it properly.)
first, I changed some stuff so the gui could be controlled by just a few variables:
gui.rpy
Code: Select all
default persistent.text_color = "#000"
default persistent.menu_color = "#6cce6f"
default persistent.background = "#fff"
## The colors used for dialogue and menu choice text.
define gui.interface_text_color = persistent.menu_color
define gui.text_color = persistent.text_color
## The images used for the main and game menus.
define gui.main_menu_background = persistent.background
define gui.game_menu_background = persistent.background
Code: Select all
style nvl_window:
background persistent.background
style main_menu_frame:
background persistent.background
Code: Select all
screen preferences():
tag menu
use game_menu(_("Preferences"), scroll="viewport"):
vbox:
hbox:
box_wrap True
...
vbox:
style_prefix "radio"
label _("Theme")
textbutton _("Light") action [ SetField(persistent, 'background', "#fff"), SetField(persistent, 'text_color', "#000") ]
textbutton _("Dark") action [ SetField(persistent, 'background', "#000"), SetField(persistent, 'text_color', "#fff") ]
(I also found something about Style Preferences, but I think it might be outdated - either that or I didn't implement it properly.)