TheoTown now supports custom user interface themes through plugins. Themes can change the appearance of menus, dialogs, buttons, text and other interface elements without modifying the game itself. This tutorial explains how to create a theme, customize its colors and, optionally, replace UI graphics.
1. Creating your first theme
A theme is defined like other TheoTown plugin drafts using JSON. Here is a simple dark theme with purple accents:
Code: Select all
[
{
"id": "$my_purple_theme",
"type": "theme",
"title": "Purple Night",
"text": "A dark interface with purple accents.",
"dark": true,
"text color": "#FFFFFF",
"secondary text color": "#BBBBCC",
"accent text color": "#CC99FF",
"background color": "#191525",
"menu background color": "#242035",
"menu item color": "#322B48",
"menu text color": "#FFFFFF",
"window title color": "#CC99FF",
"selected text color": "#FFFFFF"
}
]
Code: Select all
"type": "theme"It can then be selected like TheoTown's built-in themes.
2. Dark Teal demo theme
If you prefer to start with an existing theme, you can download the Dark Teal demo plugin provided with this tutorial. It contains a complete working theme that demonstrates the basic structure, color properties and UI customization options. You can install it directly, inspect its files and modify it to create your own theme.
The easiest way to get started is to make a copy of the plugin, change its id, title and colors, and then experiment with the remaining properties.
Important: Always give your modified theme its own unique ID before publishing it.
3. Using an existing theme as a base
You do not need to define every property yourself. Use
Code: Select all
"dark": true
Code: Select all
"dark": false
A theme can also use another theme as its base:
Code: Select all
{
"id": "$my_blue_theme",
"type": "theme",
"title": "Blue Night",
"base": "$my_purple_theme",
"accent text color": "#66AAFF"
}
4. Available color properties
General interface colors
- text color
- selected text color
- secondary text color
- accent text color
- red text color
- green text color
- yellow text color
- orange text color
- background color
- menu background color
- menu item color
- menu title color
- menu text color
- window title color
- item background color 0
- item background color 1
- indicator rank color
- indicator text color
- indicator text green color
- indicator text red color
- indicator text yellow color
- indicator text uber color
- indicator selection color
5. Customizing interface graphics
More advanced themes can also replace graphics used by the interface. This includes:
- checkbox off frame
- checkbox on frame
- radio off frame
- radio on frame
- close button frame
Nine-Patches Many interface elements use nine-patch rendering. A nine-patch consists of nine image sections arranged in a 3×3 grid. This allows elements such as windows and buttons to be resized without stretching their corners. The patches may have non uniform sizes, but each border must have constant thickness.
Supported nine-patch properties include:
- panel frames
- window frames
- button frames
- button down frames
- button marked frames
- button blue frames
- button blue down frames
- list item frames
- list item selected frames
- list box frames
- notification bar frames
- progress bar frames
- progress bar filled frames
- rect frames
- rect shadow frames
- white rect frames
- white rect bordered frames
- white rect empty frames
- indicator frames
- button gold frames
- button green frames
If you are new to TheoTown's frame system, starting with color customization is recommended before replacing interface graphics. See the demo theme to get familiar with how the frames are used.
6. Testing your theme
It is worth testing these areas in particular:
- Main menu and settings
- Building selection
- City information and statistics
- Budget window
- Plugin Store
- Confirmation dialogs
- Notifications
7. Sharing your theme
Once your theme is ready, you can publish it through TheoTown's Plugin Store. Other players can then download it and select it through their user interface settings.
I'm looking forward to seeing what you create!