Documentation Index
Fetch the complete documentation index at: https://mintlify.com/birdflop/web/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The RGBirdflop SDK provides a unified gradient interface that supports multiple color space interpolation methods. TheColorGradient and ColorAnimatedGradient classes offer perceptually smooth color transitions using various color spaces.
ColorGradient
Unified gradient interface that can switch between RGB, HSL, OKLAB, OKLCh, CIELAB, and LuvLCh interpolation.Constructor
Array of color stops with RGB values and positions.
rgb: RGB array [r, g, b] with values in 0-255 rangepos: Position in gradient (0-100)
Number of steps in the gradient sequence
Interpolation type: ‘rgb’, ‘hsl’, ‘oklab’, ‘oklch’, ‘cielab’, or ‘luvLch’
Methods
next()
Gets the next color in the gradient sequence.RGB array [r, g, b] with values in 0-255 range
getType()
Gets the current gradient type.The interpolation type used by this gradient
Usage Example
ColorAnimatedGradient
Animated gradient interface with offset support for creating animation effects.Constructor
Array of color stops with RGB values and positions
Number of steps in the gradient sequence
Starting offset for animation (used to shift the gradient)
Interpolation type
Methods
Same asColorGradient: next() and getType()
Usage Example
GradientType
Union type of all available gradient interpolation types.Available Types
Linear RGB interpolation - Fast, simple, but may appear muddy in some transitions (e.g., red to green passes through brown)
HSL color space interpolation - Intuitive color transitions that follow the color wheel, great for rainbow effects
OKLAB interpolation - Perceptually uniform color space, recommended for smooth, natural-looking gradients
OKLCh interpolation - Cylindrical OKLAB (Lightness, Chroma, Hue), great for controlling saturation and brightness
CIE Lab interpolation* - Industry-standard perceptually uniform color space
CIE LCh (based on CIELUV) - Alternative perceptually uniform cylindrical color space
Comparison Example
GRADIENT_TYPES
Const array containing all available gradient type values (single source of truth).Individual Gradient Classes
For direct use, you can import specific gradient implementations:ColorGradient and ColorAnimatedGradient.
Base Gradient Architecture
TwoStopGradient Interface
Each gradient type implements this interface for two-color interpolation:BaseGradient Class
Common gradient logic shared by all gradient types:- Normalizes color stops (ensures 0% and 100% positions)
- Creates gradient segments between color pairs
- Handles step sequencing with easing function
- Manages color stop position swapping
Advanced Usage
Custom Color Positions
Multi-Color Text Gradient
Related
- Generate Output - Use gradients with text
- Color Utilities - Convert between color spaces
- Format Options - Configure gradient settings
Implementation
Source:packages/rgbirdflop/src/util/ColorUtils/index.ts:24
Base implementation: packages/rgbirdflop/src/util/ColorUtils/BaseGradient.ts:81