godot-ui-theming
35
总安装量
5
周安装量
#10571
全站排名
安装命令
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-ui-theming
Agent 安装分布
opencode
5
gemini-cli
5
codex
5
claude-code
3
github-copilot
3
Skill 文档
UI Theming
Theme resources, StyleBox styling, font management, and override system define consistent UI visual identity.
Available Scripts
global_theme_manager.gd
Expert theme manager with dynamic switching, theme variants, and fallback handling.
ui_scale_manager.gd
Runtime theme switching and DPI/Resolution scale management.
NEVER Do in UI Theming
- NEVER create StyleBox in _ready() for many nodes â 100 buttons Ã
StyleBoxFlat.new()in_ready()? 100 duplicate objects. Create ONCE in theme resource, reuse via inheritance. - NEVER forget theme inheritance â Child Control with custom theme? Parent theme ignored. Set
themeon root Control, children auto-inherit unless overriding. - NEVER hardcode colors in StyleBox â
style.bg_color = Color(0.2, 0.3, 0.5)? Unmaintainable. Define colors in theme, reference viatheme.get_color("primary", "Button"). - NEVER use add_theme_override for global styles â Call
add_theme_*_override()on 50 nodes? Brittle. Define in Theme resource for automatic propagation. - NEVER skip corner_radius_all shortcut â Set 4 corner radii individually? Verbose. Use
corner_radius_all = 5for uniform corners (StyleBoxFlat only). - NEVER modify theme during rendering â Change theme in
_draw()OR_process()? Constant re-layout = performance tank. Load themes at initialization OR on user action only.
- Project Settings â GUI â Theme
- Create new Theme resource
- Assign to root Control node
- All children inherit theme
StyleBox Pattern
# Create StyleBoxFlat for buttons
var style := StyleBoxFlat.new()
style.bg_color = Color.DARK_BLUE
style.corner_radius_top_left = 5
style.corner_radius_top_right = 5
style.corner_radius_bottom_left = 5
style.corner_radius_bottom_right = 5
# Apply to button
$Button.add_theme_stylebox_override("normal", style)
Font Loading
# Load custom font
var font := load("res://fonts/my_font.ttf")
$Label.add_theme_font_override("font", font)
$Label.add_theme_font_size_override("font_size", 24)
Reference
Related
- Master Skill: godot-master