documentation index ◦ reference manual ◦ function index
Contents |
Themes provide a simple way of changing the look of the main and game menus. A single function call applies styles to many of the elements of the main and game menus, giving a consistent look to the interface.
Theme functions should be called after the config.screen_width, config.screen_height, and library.script_version variables have been set, and after any layout functions have been called. They should be called before any style is changed by hand.
These theme functions are
Function: | theme.roundrect | (widget="#003c78", widget_hover="#0050a0", widget_text="#c8e1ff", widget_selected="#ffffc8", disabled="#404040", disabled_text="#c8c8c8", label=,"#ffffff" frame="#6496c8", window="#000000c0", text_size=None, small_text_size=None, mm_root=..., gm_root=..., less_rounded=False): |
This enables the use of the roundrect theme. By default, this theme styles the game in a blue color scheme. However, by supplying one or more of the parameters given below, the color scheme can be changed.
widget - The background color of non-focued buttons and sliders.
widget_hover - The background color of focused buttons and sliders.
widget_text - The text color of non-selected buttons.
widget_selected - The text color of selected buttons.
disabled - The background color of disabled buttons.
disabled_text - The text color of disabled buttons.
label - The text color of non-selected labels.
frame - The background color of frames.
mm_root - A displayable (such as an Image or Solid) that will be used as the background for the main menu.
gm_root - A displayable (such as an Image or Solid) that will be used as the background for the game menu.
less_rounded - If True, causes the buttons to appear less rounded in 800x600 mode (has no effect in 640x480 mode).
text_size - The size of text, such as button captions, labels, and prompts. Defaults to 18 if the screen is 640 pixels wide or less, and 22 otherwise.
small_text_size - The size of the text on large buttons. Defaults to 12 if the screen is 640 pixels wide or less, and 16 otherwise.
widget, widget_hover, disabled, and frame may either be single colors, or tuples containing two colors. In the latter case, a vertical gradient is used.
The following functions exist to allow you to add elements of the roundrect theme to another theme. The other theme must have been set up before these functions can be used. Arguments are as for roundrect, except that all must be specified (no defaulting occurs).
Function: | theme.outline | (inside="#fff", idle="#e66", hover="#48f", selected="#84f", insensitive="#ccc", label="#484", prompt="#484", background="#fee", large_button="#fff8f8", text_size=22, small_text_size=16): |
This function selects a theme that is based on outlining text in different colors.
inside - The color of text inside the various outlines.
idle - The outline color of the text of an idle button or bar.
hover - The outline color of a hovered button or bar.
selected - The outline color of a selected button.
insensitive - The outline color of an insensitive button.
label - The outline color of a label.
prompt - The outline color of a prompt.
background - A displayable used for the game and main menu backgrounds.
large_button - The background color of large backgrounds.
text_size - The size of large text. (Used for buttons, labels, and prompts.)
small_text_size - The size of small text. (Used in large buttons.)
The following functions exist to allow you to add elements of the outline theme to another theme. The other theme must have been set up before these functions can be used. Arguments are as for theme.outline, except that all must be specified (no defaulting occurs).
Function: | theme.ancient | (): |
This is a theme that attempts to emulate the theme used by Ren'Py 6.5.0 when no theme was explicitly specified.
These are functions that can be called after a theme function, allowing you to change a portion of a theme.
Function: | theme.image_buttons | (d): |
Used to define buttons in terms of 5-tuples of image filenames. This expects its single parameter, d, to be a dictionary mapping untranslated button names to 5-tuples. Each 5-tuple should contain 5 filenames, giving the image used for the button when:
in that order.
Function: | theme.image_labels | (d): |
Replaces labels with images. This takes a single parameter, d, which is expected to be a map from the text of a label to an image file.
It's also possible to define your own Ren'Py theme. A custom theme consists of Ren'Py code that does the following.
Often, the base styles come in name/name_text pairs. In these cases, name represents a Button or Window with style name, in which a Text with style name_text lives.
The base styles are:
Generally, themes should not adjust the margins, positioning properties, or maximum sizes of these styles. An exception is that the bars are expected to set a maximum size in a direction perpendicular to the orientation of the bar (ymaximum for bar and scrollbar; xmaximum for vbar and vscrollbar). No limitations apply to the _text styles.