Skip to main content

Overview

Themes in Godot provide a powerful system for styling UI elements. A Theme resource stores colors, fonts, icons, constants, and StyleBoxes that can be applied to Control nodes, allowing consistent visual design across your entire application.
Theme resources can be shared across multiple controls and even exported as separate files for reuse across projects.

Theme System

Applying Themes

Themes can be applied at three levels:
  1. Project-wide - Set in ProjectSettings.gui/theme/custom
  2. Branch-level - Assign to a control’s theme property
  3. Local overrides - Use add_theme_*_override() methods

Theme Inheritance

Themes propagate from parent to child controls automatically:
Local overrides always take precedence over theme settings, allowing fine-tuned customization.

Local Theme Overrides

Override specific theme properties for individual controls:

Color Overrides

Font Overrides

Constant Overrides

StyleBox

StyleBox is an abstract base class for drawing stylized boxes for UI elements like buttons, panels, and backgrounds.

StyleBoxFlat

Create solid color backgrounds with borders, rounded corners, and shadows:
Key Properties:
  • bg_color - Background color
  • border_width_* - Border width for each side
  • border_color - Border color
  • corner_radius_* - Corner radius for rounded corners
  • shadow_* - Shadow properties
  • content_margin_* - Internal padding

StyleBoxTexture

Use textures for UI backgrounds with nine-patch scaling:

Common StyleBox States

Many controls have multiple visual states:

Creating Theme Resources

Create themes programmatically:

Theme Type Variations

Create variations of existing themes for specialized controls:

Content Margins

StyleBoxes define content margins that control internal padding:
Positive content margin values reduce the available space for content, while negative values are ignored.

See Also

Control Nodes

Learn about UI elements that can be themed

Containers

Apply themes to container layouts