Theme Options
A theme option is one setting of the theme: a color or a number, with the parts of the interface it styles. The pages of the Theme category of the Settings are generated from the theme options: adding an option adds a row to a page, or a whole new page.
This is the most technical kind of mod: it adds a theme setting Candy Dialogue Creator lacks, and requires knowing how Godot themes are built, since an option names the theme items it sets.
Place theme options in a mod's Theme_Options folder (see Mods), in a .txt file. A file can contain any number of options.
An Options File
{
"options": [
{
"id": "tree_guides", "label": "Tree guide lines",
"page": "Colors", "section": "Controls",
"type": "color",
"default": Color(0.5, 0.5, 0.5, 1),
"tooltip": "The lines that link the rows of a tree.",
"targets": [
["color", "Tree", "guide_color"]
]
}
]
}
| Key | Description |
| id | The option's id: the name themes refer to it by, in their values. An option with the id of an existing one replaces it. |
| label | Its name on the Settings page. |
| page | The Settings page it is displayed on. A page that doesn't exist is created. |
| section | The heading it is displayed under on that page. |
| type | color, or number with min, max and step. |
| default | Its value in a theme that doesn't set it. |
| tooltip | Displayed when the option is hovered. |
| targets | The theme items it sets. See below. |
| column, row | Optional: display the option in a named column, on the row of an earlier option of the same section. This is how a text color and its outline share a row. |
Targets
A target is a list: a kind, a theme type, an item, and for styles a property.
| Target | Sets |
["color", "CheckBox", "font_color"] | A color of that type. |
["constant", "BoxContainer", "separation"] | A constant of that type. |
["font_size", "Label", "font_size"] | A font size of that type. |
["style", "Button", "normal", "bg_color"] | A property of a style box of that type. |
["icon_tint", "Tree", "arrow"] | The color of one of Godot's own icons. |
The type and the item can each be a list, to set every combination at once:
["style", ["Button", "OptionButton"], ["normal", "hover"], "border_color"]
For styles, besides the properties of Godot's StyleBoxFlat, border_width, corner_radius and content_margin set all four sides at once.
The type names are Godot's control types, and Candy Dialogue Creator's own types, whose names start with Candy.
Using the Option
Once the option exists:
- It is displayed on its Settings page, where users can override it for each theme.
- Themes can set it in their values, by its id.
For Reference
Candy Dialogue Creator's own options are written the same way, in the Theme_Options/candy.txt file of its Godot project. It is the reference for examples, and for the types and items that exist.