CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-ansi-colors

A high-performance terminal string styling library providing chainable ANSI color codes and text formatting for Node.js CLI applications.

Pending
Overview
Eval results
Files

text-colors.mddocs/

Text Colors

Standard foreground color functions for terminal text styling. These functions apply ANSI escape codes to change the text color while preserving the background color.

Capabilities

Standard Colors

Apply standard ANSI foreground colors to text.

/**
 * Apply black foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function black(text: string): string;

/**
 * Apply red foreground color to text  
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function red(text: string): string;

/**
 * Apply green foreground color to text
 * @param text - The text to style  
 * @returns Styled text with ANSI escape codes
 */
function green(text: string): string;

/**
 * Apply yellow foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes  
 */
function yellow(text: string): string;

/**
 * Apply blue foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function blue(text: string): string;

/**
 * Apply magenta foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function magenta(text: string): string;

/**
 * Apply cyan foreground color to text  
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function cyan(text: string): string;

/**
 * Apply white foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function white(text: string): string;

Gray Colors

Gray color variants with alias support.

/**
 * Apply gray foreground color to text
 * @param text - The text to style
 * @returns Styled text with ANSI escape codes
 */
function gray(text: string): string;

/**
 * Apply grey foreground color to text (alias for gray)
 * @param text - The text to style  
 * @returns Styled text with ANSI escape codes
 */
function grey(text: string): string;

Usage Examples:

const colors = require('ansi-colors');

// Basic color usage
console.log(colors.red('Error: Something went wrong'));
console.log(colors.green('Success: Operation completed'));
console.log(colors.yellow('Warning: Check your input'));
console.log(colors.blue('Info: Processing data'));

// Chaining with other styles
console.log(colors.red.bold('Critical error!'));
console.log(colors.green.underline('Important success message'));

// Nested colors
console.log(colors.cyan(`Status: ${colors.yellow('pending')} - please wait`));

// Gray aliases
console.log(colors.gray('Disabled option'));
console.log(colors.grey('Disabled option')); // Same as gray

Install with Tessl CLI

npx tessl i tessl/npm-ansi-colors

docs

advanced-features.md

background-colors.md

bright-colors.md

configuration.md

index.md

symbols.md

text-colors.md

text-modifiers.md

tile.json