Overview
ThegenerateOutput function is the main text generation function in the RGBirdflop SDK. It takes a configuration object and generates formatted gradient text in various output formats including MiniMessage, JSON, and template-based formats.
Function Signature
Parameters
Configuration object containing all gradient settings. See Format Options for the complete
rgbDefaults structure.Key properties:colors- Array of color stops with hex and positionshadowcolors- Optional shadow color stopstext- The text to apply the gradient toformat- Output format (MiniMessage, JSON, or template)colorlength- Number of characters per color segmentgradientType- Gradient interpolation type (‘rgb’, ‘hsl’, ‘oklab’, ‘oklch’, ‘cielab’, ‘luvLch’)- Formatting flags:
bold,italic,underline,strikethrough,obfuscate prefixsuffix- Wrapper template with$tplaceholdertrimspaces- Whether to skip gradient for whitespace-only segmentslowercase- Convert output to lowercase
Return Value
Formatted gradient text string in the specified format:
- MiniMessage:
<gradient:#color1:#color2>text</gradient>or<color:#hex>text</color> - JSON: Serialized JSON with
{text: "", extra: [{text: "...", color: "#...", ...}]} - Template: Custom format using placeholders like
&#$1$2$3$4$5$6$f$c
Usage Examples
Basic Gradient
Single Color
JSON Format with Formatting
Template Format (Bukkit/Spigot)
Custom Gradient Positions
With Shadow Colors (MiniMessage)
Format Templates
Template formats use these placeholders:$1through$6- Individual hex digits$f- Format codes (bold, italic, etc.)$c- The character/text segment$t- Full text (in wrapper templates)
Related Functions
- Color Utilities - Color conversion helpers
- Gradient Types - ColorGradient class and types
- Format Options - Configuration defaults
Implementation Details
The function internally:- Sorts colors by position
- Detects single-color vs multi-color gradients
- Routes to format-specific renderers:
renderMiniMessageGradientfor MiniMessagerenderJsonGradientfor JSONrenderTemplateGradientfor template formats
- Applies formatting wrappers (bold, italic, etc.)
- Applies prefix/suffix if configured
packages/rgbirdflop/src/util/RGBUtils.ts:168