thedivergentai/godot-ui-rich-text
Expert blueprint for RichTextLabel with BBCode formatting (bold, italic, colors, images, clickable links) and custom effects. Covers meta tags, RichTextEffect shaders, and dynamic content. Use when implementing dialogue systems OR formatted text. Keywords RichTextLabel, BBCode, [b], [color], [url], meta_clicked, RichTextEffect, dialogue.
npx skills add https://github.com/thedivergentai/GD-Agentic-Skills --skill godot-ui-rich-text
BBCode tags, meta clickable links, and RichTextEffect shaders define formatted text systems.
Expert custom RichTextEffect that rotates colors over time.
Professional horror-style glitch effects with spatial jitter and alpha flickering.
Dialogue manager that parses sequential event tags ([pause], [speed]) during animations.
Advanced handling for multi-prefix URLs in meta-clicks (items, quests, NPCs).
Utility to dynamically scale [img] tags to match runtime font sizes.
Signals and logic for making text spans reactive to mouse hover (SFX/Cursors).
Security utility to prevent BBCode injection in public chat interfaces.
Generator for multi-stop linear gradients using granular character-level tagging.
Smooth vertical auto-scrolling logic for credits, news feeds, and logs.
Simple regex-based syntax highlighting pattern for code blocks in UI.
RichTextLabel.custom_effects list via Inspector or install_effect().[img width=128] fails on higher resolutions. Use rich_text_image_scaler.gd to sync with line height.rich_text_hover_reactive.gd.text or bbcode string frame-by-frame; strictly use visible_ratio or visible_characters to avoid expensive parsing overhead and flickering.meta_clicked — This signal is on the Main Thread. Use it to emit a command and handle processing asynchronously if needed.visible_ratio for pausing typewriter — visible_ratio is unreliable for per-character logic. Use visible_characters and explicit character indexing (rich_text_typewriter_controller.gd).img]huge_image_path[/img] or [color=transparent] to break your UI. MANDATORY: pipe every user-generated string through [rich_text_bbcode_sanitizer.gd before assigning text.$RichTextLabel.bbcode_enabled = true
$RichTextLabel.text = "[b]Bold[/b] and [i]italic[/i] text"
width_in_percent / height_in_percent removed — use width_unit / height_unit with RichTextLabel.ImageUnit enum.ImageUpdateMask.UPDATE_WIDTH_IN_PERCENT renamed to UPDATE_WIDTH_UNIT.add_image / update_image width and height are now float, not int.true/false for percent flags — use RichTextLabel.ImageUnit values (default changed from false to 0).| Need | API | MANDATORY |
|------|-----|---------------|
| Simple fade / whole-line reveal | visible_ratio + Tween | Inline ok (see pattern below) |
| Pause / speed / event tags (pause], [speed]) | visible_characters + indexer | [rich_text_typewriter_controller.gd |
> NEVER use visible_ratio when you need per-character pause/speed tags.
Skip cataloging [b] / [i] / [u] / [color] — see docs. Prefer these when non-obvious:
url=payload]…[/url] + meta_clicked — prefer [rich_text_meta_dispatch.gdimg] sizing — Godot 4.7: use width_unit / height_unit + RichTextLabel.ImageUnit (see section above); scale with [rich_text_image_scaler.gdcustom_effects / install_effect(); examples: rich_text_rainbow_effect.gd, rich_text_glitch_effect.gdMANDATORY: rich_text_bbcode_sanitizer.gd on any chat, lobby, or player-typed path before RichTextLabel.text = ….
Prefer rich_text_meta_dispatch.gd. Minimal hook:
func _ready() -> void:
$RichTextLabel.meta_clicked.connect(_on_meta_clicked)
func _on_meta_clicked(meta: Variant) -> void:
# Emit a command; do not run heavy game logic here
pass
Enable crisp, high-resolution outlines and scaling by enabling MSDF on font resources and using theme overrides.
# msdf_styler.gd
func _ready():
# Crisp outlines regardless of screen scale
label.add_theme_color_override("font_outline_color", Color.BLACK)
label.add_theme_constant_override("outline_size", 4)
Simple fade — tween visible_ratio (keeps BBCode effects; no string rewrite):
func reveal_fade(label: RichTextLabel, new_text: String, duration: float) -> void:
label.text = new_text
label.visible_ratio = 0.0
create_tween().tween_property(label, "visible_ratio", 1.0, duration)
Pause/speed tags — MANDATORY rich_text_typewriter_controller.gd using visible_characters (not visible_ratio).
Define custom visual tags (like [relic]) by extending RichTextEffect for unique gameplay-themed text animations.
# relic_effect.gd
@tool
extends RichTextEffect
var bbcode = "relic"
func _process_custom_fx(char_fx: CharFXTransform):
# Retrieve param: [relic color=#ff00ff]
var color = char_fx.env.get("color", Color.GOLD)
# Apply sinusoidal floating
char_fx.offset.y += sin(char_fx.elapsed_time * 5.0) * 2.0
char_fx.color = color
return true
> LLM-ignorance rule: if a general agent would not know it before reading, it lives here or in scripts/ — never delete, only move.
| Topic | Reference |
|-------|-----------|
| Tag catalog + 4.7 img units | bbcode-tag-catalog.md |
> Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.
[url] meta for dialogue and formatted UI copy.bbcode_enabled, visible_characters / visible_ratio, meta_clicked, and custom_effects / install_effect().bbcode id + _process_custom_fx).env params used by rainbow/glitch/custom effects.[url] / meta spans.tr() / CSV keys so BBCode templates stay localization-ready.meta_clicked / hover signals without stuffing game logic into the label.visible_ratio / visible_characters for typewriter reveals without re-parsing BBCode every frame.@tool, and RefCounted helpers used by sanitizers, highlighters, and effect scripts.visible_ratio and auto-scroll polish.visible_characters, and meta choice links.Take thedivergentai/godot-ui-rich-text from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.