Advanced text transformation effects including rainbow colors, zalgo text, themed patterns, and custom character transformations.
Multi-color effects that apply different colors to individual characters in sequence.
/**
* Apply rainbow color cycling effect (red, yellow, green, blue, magenta pattern)
* @param str - Text to apply rainbow colors to
* @returns Text with rainbow color pattern
*/
function rainbow(str: string): string;
/**
* Apply alternating inverse styling effect (zebra stripe pattern)
* @param str - Text to apply zebra pattern to
* @returns Text with alternating inverse characters
*/
function zebra(str: string): string;
/**
* Apply American flag color pattern (red, white, blue cycling)
* @param str - Text to apply America colors to
* @returns Text with red/white/blue color pattern
*/
function america(str: string): string;
/**
* Apply random colors and styles to each character
* @param str - Text to apply random styling to
* @returns Text with randomly colored and styled characters
*/
function random(str: string): string;Advanced text effects that modify the actual characters or add combining characters.
/**
* Apply "trap" character transformation using Unicode substitution
* @param str - Text to transform (defaults to "Run the trap, drop the bass" if not provided)
* @param options - Transformation options (currently unused)
* @returns Text with characters replaced by trap-style Unicode variants
*/
function trap(str?: string, options?: any): string;
/**
* Apply zalgo text effect with combining characters for chaotic appearance
* @param str - Text to transform (defaults to " he is here " if not provided)
* @param options - Zalgo transformation options
* @returns Text with combining characters creating distorted appearance
*/
function zalgo(str?: string, options?: ZalgoOptions): string;interface ZalgoOptions {
/** Add combining characters above text (default: true) */
up?: boolean;
/** Add combining characters in middle of text (default: true) */
mid?: boolean;
/** Add combining characters below text (default: true) */
down?: boolean;
/** Intensity of effect: 'mini', 'maxi', or other values (default: 'maxi') */
size?: 'mini' | 'maxi' | string;
}Color Pattern Effects:
const colors = require('colors/safe');
console.log(colors.rainbow('Rainbow text with cycling colors'));
console.log(colors.zebra('Alternating inverse pattern'));
console.log(colors.america('Red white and blue pattern'));
console.log(colors.random('Every character different colors'));Character Transformation Effects:
const colors = require('colors/safe');
console.log(colors.trap('Transform to trap style'));
console.log(colors.zalgo('Distorted zalgo text'));
// Custom zalgo options
console.log(colors.zalgo('Custom zalgo', {
up: true,
mid: false,
down: true,
size: 'mini'
}));String Prototype API:
const colors = require('colors');
console.log('Rainbow colors!'.rainbow);
console.log('Zebra stripes!'.zebra);
console.log('USA colors!'.america);
console.log('Random styling!'.random);
console.log('Trap transformation!'.trap);
console.log('Zalgo effect!'.zalgo);Combining with other effects:
const colors = require('colors/safe');
// Apply rainbow to already bold text
console.log(colors.rainbow(colors.bold('Bold rainbow text')));
// Apply trap transformation then color it
console.log(colors.red(colors.trap('Red trap text')));
// Complex combinations
console.log(colors.underline.rainbow('Underlined rainbow text'));When using the default import, all special effect functions are available as getters on String.prototype:
interface String {
rainbow: string;
zebra: string;
america: string;
random: string;
trap: string;
zalgo: string;
}