Theme Manage
theme_manageCreate and edit Godot Theme resources programmatically: set colors, constants, fonts, icons, and styleboxes, then apply themes to Control nodes for cascading styling.
Instructions
Theme authoring (Godot's stylesheet-like resource for Controls). Cascades down a Control subtree when assigned via theme_apply.
Stylebox numeric fields (border widths, corner radii, margins, shadow) must be finite numbers and stylebox flags (anti_aliasing, draw_center) must be real booleans; a non-numeric or non-finite value is refused with a structured error before anything is applied, so a refused call leaves the theme and undo history untouched.
Slot changes are persisted immediately: if the theme file cannot be written the call fails with an error, the previous slot is restored, and no undo entry is committed.
Ops (pass via op="..." plus a params dict):
• create(path, overwrite=False)
Create a new empty Theme .tres at a res:// path.
• set_color(theme_path, class_name, name, value)
Set a color slot. value: "#rrggbb"/"#rrggbbaa", named, or
{"r","g","b","a"}.
• set_constant(theme_path, class_name, name, value)
Set an integer constant (separation, margin, padding).
• set_font_size(theme_path, class_name, name, value)
Set a font_size slot in pixels.
• set_stylebox_flat(theme_path, class_name, name, bg_color?, border_color?,
border?, corners?, margins?, shadow?, anti_aliasing?)
Compose a StyleBoxFlat (panels, button states, line edits).
border/corners/margins/shadow each accept "all" + per-side keys.
• set_stylebox_texture(theme_path, class_name, name, texture_path,
region?, margins?, axis_stretch_horizontal?,
axis_stretch_vertical?, modulate_color?, draw_center?)
Compose a 9-slice StyleBoxTexture from an imported image — pixel-art
buttons and artwork-backed panels. region is {position, size} or
[x,y,w,h]; margins are {all|left|top|right|bottom}; axis stretch modes
are "stretch" | "tile" | "tile_fit".
• set_font(theme_path, class_name, name, font_path)
Assign a Font resource (FontFile .ttf/.otf, FontVariation) to a font
slot. Loads the imported resource from res://.
• set_icon(theme_path, class_name, name, texture_path)
Assign a Texture2D to an icon slot (checkbox marks, dropdown arrows).
• stylebox_override(path, slot, patch)
Per-node stylebox override: duplicate the stylebox the Control
resolves for slot, apply a StyleBoxFlat patch (same keys as
set_stylebox_flat; unknown top-level keys are refused), and attach it
via add_theme_stylebox_override. The action lands in the scene's undo
history, so the editor's scene undo restores the previous override or
removes it. The zero-border angular-frame / flash-the-bar-bg pattern
without mutating the theme.
• apply(node_path, theme_path="")
Assign the theme to a Control (cascades to descendants). Empty
theme_path clears.
All ops accept session_id on the wrapper to target a specific editor.
Canonical call shape: {"op": "<verb>", "params": {...}}. Flat op parameters are accepted as a compatibility alias when the client transmits them; op and session_id remain top-level.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | ||
| params | No | ||
| session_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||