Godot ui rich text

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot ui rich text is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. 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],

How to use this skill

Skill file

Rich Text & BBCode

BBCode tags, meta clickable links, and RichTextEffect shaders define formatted text systems.

Available Scripts

[rich_text_rainbow_effect.gd](scripts/rich_text_rainbow_effect.gd)

Expert custom RichTextEffect that rotates colors over time.

[rich_text_glitch_effect.gd](scripts/rich_text_glitch_effect.gd)

Professional horror-style glitch effects with spatial jitter and alpha flickering.

[rich_text_typewriter_controller.gd](scripts/rich_text_typewriter_controller.gd)

Dialogue manager that parses sequential event tags ([pause], [speed]) during animations.

[rich_text_meta_dispatch.gd](scripts/rich_text_meta_dispatch.gd)

Advanced handling for multi-prefix URLs in meta-clicks (items, quests, NPCs).

[rich_text_image_scaler.gd](scripts/rich_text_image_scaler.gd)

Utility to dynamically scale [img] tags to match runtime font sizes.

[rich_text_hover_reactive.gd](scripts/rich_text_hover_reactive.gd)

Signals and logic for making text spans reactive to mouse hover (SFX/Cursors).

[rich_text_bbcode_sanitizer.gd](scripts/rich_text_bbcode_sanitizer.gd)

Security utility to prevent BBCode injection in public chat interfaces.

[rich_text_gradient_generator.gd](scripts/rich_text_gradient_generator.gd)

Generator for multi-stop linear gradients using granular character-level tagging.

[rich_text_auto_scroller.gd](scripts/rich_text_auto_scroller.gd)

Smooth vertical auto-scrolling logic for credits, news feeds, and logs.

[rich_text_syntax_highlighter.gd](scripts/rich_text_syntax_highlighter.gd)

Simple regex-based syntax highlighting pattern for code blocks in UI.

NEVER Do (Expert UI Rules)

Formatting & Rendering

Click & Hover UX

Dialogue & Narrative


$RichTextLabel.bbcode_enabled = true
$RichTextLabel.text = "[b]Bold[/b] and [i]italic[/i] text"

Reveal API Decision

| 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.

Non-Obvious Tags & Effects

Skip cataloging [b] / [i] / [u] / [color] — see docs. Prefer these when non-obvious:

User-Generated Rich Text

MANDATORY: rich_text_bbcode_sanitizer.gd on any chat, lobby, or player-typed path before RichTextLabel.text = ….

Handle Link Clicks

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

Expert Text Patterns

1. Rich-Text-MSDF-Outline (SDF)

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)

2. Animated-Text-Reveal

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).

3. Custom-BBCode-Effect (RichTextEffect)

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

Deep recipes (on demand)

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 |

Reference

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.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.