### Development Setup for SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Instructions for setting up the SimpleChalk development environment, including cloning the repository, installing dependencies, and running initial tests. This is the starting point for contributing to the project.
```bash
git clone https://github.com/Alcyone-Labs/simple-chalk
cd simple-chalk
pnpm install
pnpm test
```
--------------------------------
### SimpleChalk Basic Usage Examples
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Demonstrates the clean and familiar API of SimpleChalk for terminal coloring, including default imports and the highly performant 'fast' option. It also shows browser compatibility.
```typescript
import chalk from '@alcyone-labs/simple-chalk';
console.log(chalk.red.bold('Error message'));
// Or choose the fastest option
import { fast } from '@alcyone-labs/simple-chalk';
console.log(fast.redBold('Lightning fast!'));
// Perfect for browsers too
import { browser } from '@alcyone-labs/simple-chalk';
console.log(...browser.red('Works everywhere!'));
```
--------------------------------
### SimpleChalk Basic Usage Examples
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Provides comprehensive examples of using SimpleChalk for basic colors, text styles, and chaining multiple styles together for rich terminal output.
```typescript
import chalk from '@alcyone-labs/simple-chalk';
// Basic colors
console.log(chalk.red('Error message'));
console.log(chalk.green('Success message'));
console.log(chalk.blue('Info message'));
// Text styles
console.log(chalk.bold('Bold text'));
console.log(chalk.dim('Dimmed text'));
console.log(chalk.underline('Underlined text'));
// Chaining
console.log(chalk.red.bold('Bold red text'));
console.log(chalk.blue.underline('Underlined blue text'));
console.log(chalk.green.bold.dim('Green, bold, and dimmed'));
```
--------------------------------
### SimpleChalk Installation
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Provides commands for installing SimpleChalk using different package managers like npm, pnpm, and yarn.
```bash
npm install @alcyone-labs/simple-chalk
```
```bash
pnpm add @alcyone-labs/simple-chalk
```
```bash
yarn add @alcyone-labs/simple-chalk
```
--------------------------------
### Publishing Scripts for SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Commands for validating, testing, and publishing SimpleChalk to a package registry. Includes dry-run options to ensure a smooth publishing process.
```bash
npm run validate # Run linting and tests
npm run publish:dry-run # Test publish without actually publishing
npm run publish:npm # Publish to NPM
```
--------------------------------
### Testing Scripts for SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Scripts to run tests for SimpleChalk, including watch mode, single execution, and coverage reports. Comprehensive testing ensures compatibility and stability across different versions and environments.
```bash
npm test # Run tests in watch mode
npm run test:run # Run tests once (74 tests)
npm run test:coverage # Run tests with coverage
```
--------------------------------
### SimpleChalk Fast Version (Maximum Performance)
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Illustrates two methods for importing the 'fast' version of SimpleChalk for maximum performance, either via a named import or a direct import path.
```typescript
// Option 1: Named import
import { fast } from '@alcyone-labs/simple-chalk';
console.log(fast.redBold('140x faster than default'));
// Option 2: Direct import
import chalk from '@alcyone-labs/simple-chalk/fast';
console.log(chalk.redBold('Same performance, direct import'));
```
--------------------------------
### Benchmark Command for SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
The command to run the performance benchmark comparison for SimpleChalk and other related libraries. This helps in understanding the performance characteristics of different versions.
```bash
npm run benchmark # Run performance comparison
```
--------------------------------
### SimpleChalk Default Import (Full Chalk Compatibility)
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Shows how to use the default import for SimpleChalk, which offers full compatibility with Chalk's chaining syntax for applying multiple styles.
```typescript
import chalk from '@alcyone-labs/simple-chalk';
// Full chaining support
console.log(chalk.red.bold.underline('Fully compatible with Chalk'));
```
--------------------------------
### SimpleChalk Supported Features - Function Usage
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Explains the supported ways to use SimpleChalk as a function, either directly or by calling specific color methods.
```typescript
chalk('text') // returns text as-is
chalk.red('text')
```
--------------------------------
### Build Scripts for SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Commands to build SimpleChalk in various formats (CommonJS, ES modules, TypeScript definitions). These scripts are essential for preparing the library for distribution and usage in different environments.
```bash
npm run build # Build all formats
npm run build:cjs # Build CommonJS
npm run build:esm # Build ES modules
npm run build:types # Build TypeScript definitions
```
--------------------------------
### SimpleChalk - The Solution for Browser Formatting
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Presents the solution for browser compatibility by using the spread operator with SimpleChalk's output to ensure text is properly formatted with CSS styles.
```javascript
// This shows actual red text in browsers
console.log(...chalk.red('Red text'));
```
--------------------------------
### SimpleChalk Browser Support - CSS-Based
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Recommends and shows how to use the CSS-based approach for SimpleChalk in browsers for proper color rendering. It utilizes the spread operator for applying styles.
```html
```
--------------------------------
### SimpleChalk Supported Features - Basic Colors
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Lists the basic color functions supported by SimpleChalk, confirming compatibility with standard color names.
```typescript
chalk.black('text')
chalk.red('text')
chalk.green('text')
chalk.yellow('text')
chalk.blue('text')
chalk.magenta('text')
chalk.cyan('text')
chalk.white('text')
chalk.gray('text')
chalk.grey('text') // alias for gray
```
--------------------------------
### SimpleChalk Browser Support - Named Import
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Illustrates using the 'browser' named import from SimpleChalk, which provides CSS-based styling for browser compatibility.
```typescript
import { browser } from '@alcyone-labs/simple-chalk';
console.log(...browser.red('CSS-based colors'));
```
--------------------------------
### SimpleChalk Supported Features - Chaining
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Confirms that SimpleChalk fully supports chaining multiple color and modifier functions together, similar to the original Chalk library.
```typescript
chalk.red.bold('text')
chalk.blue.underline('text')
chalk.green.bold.dim('text')
// Any combination of colors and modifiers
```
--------------------------------
### SimpleChalk Browser Support - ANSI Codes
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Demonstrates using SimpleChalk in a browser environment with the default import, which may display raw ANSI codes in older Chrome versions.
```html
```
--------------------------------
### Simple Migration from Chalk to SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Migrating from the standard Chalk library to SimpleChalk is straightforward. The process primarily involves updating the import statement. For most common usage patterns, existing code will function identically after changing the import path from 'chalk' to '@alcyone-labs/simple-chalk'.
```typescript
// Before
import chalk from 'chalk';
// After
import chalk from '@alcyone-labs/simple-chalk';
// All your existing code works the same!
console.log(chalk.red.bold('Hello World'));
```
--------------------------------
### SimpleChalk Supported Features - Special Aliases
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Notes the support for special aliases in SimpleChalk, such as 'blueBright' which maps to cyan.
```typescript
chalk.blueBright('text') // maps to cyan
```
--------------------------------
### SimpleChalk Default and Fast Version Usage
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
SimpleChalk offers different versions for various needs. The 'Default' version provides full compatibility with Chalk's chaining syntax. The 'Fast' version is optimized for maximum performance by using pre-created color combinations, achieving significantly higher operations per second.
```typescript
chalk.red.bold.underline('Full compatibility')
```
```typescript
chalk.redBold('23.8M operations/second')
```
--------------------------------
### Migration and Workarounds for Unsupported SimpleChalk Features
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
For most use cases, SimpleChalk is a direct replacement for Chalk. For unsupported features, consider conditional imports to use Chalk when needed, fallback to raw ANSI escape codes, or use full Chalk during development while opting for SimpleChalk in production builds to leverage its performance benefits.
```typescript
// These work identically in both Chalk and SimpleChalk
console.log(chalk.red('Error'));
console.log(chalk.green.bold('Success'));
console.log(chalk.yellow.underline('Warning'));
```
```typescript
const chalk = process.env.BUNDLED
? require('@alcyone-labs/simple-chalk')
: require('chalk');
```
```typescript
// Instead of chalk.bgRed('text')
console.log('\x1b[41m' + text + '\x1b[0m');
```
--------------------------------
### Import and Use SimpleChalk in Browser (JavaScript)
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/browser-test.html
Demonstrates importing and using both the ANSI and browser-optimized versions of SimpleChalk in a browser environment. The browser version requires the spread operator for outputting colors.
```javascript
// Import all versions
import chalk from './dist/esm/index.js';
import chalkFast from './dist/esm/SimpleChalkFast.js';
import chalkBrowser from './dist/esm/SimpleChalkBrowser.js';
console.log('=== SimpleChalk Browser Test ===');
console.log('');
console.log('1. ANSI Version (may show raw codes):');
console.log(chalk.red('Red text from ANSI version'));
console.log(chalk.green('Green text from ANSI version'));
console.log('');
console.log('2. Browser-Optimized Version (should show colors):');
console.log(...chalkBrowser.red('Red text from browser version'));
console.log(...chalkBrowser.green('Green text from browser version'));
console.log(...chalkBrowser.blue('Blue text from browser version'));
console.log(...chalkBrowser.bold('Bold text from browser version'));
console.log(...chalkBrowser.redBold('Red and bold from browser version'));
console.log('');
console.log('3. Environment detection:');
console.log('typeof window:', typeof window);
console.log('typeof document:', typeof document);
console.log('typeof process:', typeof process);
console.log('');
console.log('4. Usage instructions:');
console.log('For browsers, use the browser-optimized version with spread operator:');
console.log('console.log(...chalk.red("text")) instead of console.log(chalk.red("text"))');
console.log('');
console.log('If you see actual colors above (not codes), the browser version works! 🎉');
```
--------------------------------
### SimpleChalk - The Problem with Raw ANSI Codes in Browsers
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Highlights a potential issue where console logging might display raw ANSI escape codes instead of formatted text in certain browser environments.
```javascript
// This might show raw codes: [31mRed text[0m
console.log(chalk.red('Red text'));
```
--------------------------------
### SimpleChalk Supported Features - Text Modifiers
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
Details the text modifier functions that SimpleChalk supports, including bold, dim, and underline.
```typescript
chalk.bold('text')
chalk.dim('text')
chalk.underline('text')
```
--------------------------------
### Environment Variables for Color Control in SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
SimpleChalk supports standard environment variables to control color output. NO_COLOR disables colors, FORCE_COLOR enables them even in non-TTY environments, and MCP_MODE is a SimpleChalk-specific option to disable colors for MCP compliance. These variables can be set to '1' to activate their respective behaviors.
```typescript
// ✅ All supported
process.env.NO_COLOR // Disables colors
process.env.FORCE_COLOR // Forces colors
process.env.MCP_MODE // Disables colors (SimpleChalk specific)
```
```typescript
// Disable colors
process.env.NO_COLOR = '1';
console.log(chalk.red('Error')); // Outputs: "Error" (no colors)
// Force colors
process.env.FORCE_COLOR = '1';
console.log(chalk.red('Error')); // Outputs: "\x1b[31mError\x1b[0m" (with colors)
```
--------------------------------
### SimpleChalk Browser Version for CSS Colors
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
SimpleChalk includes a 'Browser' version specifically designed for web environments. This version generates CSS-based color styles, ensuring perfect color rendering and consistency within web browsers, unlike terminal-specific ANSI codes.
```typescript
console.log(...chalk.red('Perfect browser colors'))
```
--------------------------------
### Unsupported Chalk Features in SimpleChalk
Source: https://github.com/alcyone-labs/simple-chalk/blob/main/README.md
SimpleChalk does not support advanced styling or color modes available in the original Chalk library. This includes background colors, advanced text styles like italic and strikethrough, 256-color and TrueColor support (RGB, hex, HSL, HSV, HWB), template literal formatting, color level detection, and most bright color variants. These features are marked with ❌ Not supported.
```typescript
chalk.bgRed('text') // ❌ Not supported
chalk.bgBlue('text') // ❌ Not supported
chalk.bgGreen('text') // ❌ Not supported
// All bg* methods are not supported
```
```typescript
chalk.italic('text') // ❌ Not supported
chalk.strikethrough('text') // ❌ Not supported
chalk.inverse('text') // ❌ Not supported
chalk.hidden('text') // ❌ Not supported
chalk.overline('text') // ❌ Not supported
```
```typescript
chalk.ansi256(93)('text') // ❌ Not supported
chalk.bgAnsi256(93)('text') // ❌ Not supported
chalk.rgb(255, 136, 0)('text') // ❌ Not supported
chalk.bgRgb(255, 136, 0)('text') // ❌ Not supported
chalk.hex('#FF8800')('text') // ❌ Not supported
chalk.bgHex('#FF8800')('text') // ❌ Not supported
chalk.hsl(32, 100, 50)('text') // ❌ Not supported
chalk.bgHsl(32, 100, 50)('text') // ❌ Not supported
chalk.hsv(32, 100, 100)('text') // ❌ Not supported
chalk.bgHsv(32, 100, 100)('text') // ❌ Not supported
chalk.hwb(32, 0, 50)('text') // ❌ Not supported
chalk.bgHwb(32, 0, 50)('text') // ❌ Not supported
```
```typescript
chalk`{red Hello} {blue World}` // ❌ Not supported
```
```typescript
chalk.level // ❌ Not supported
chalk.supportsColor // ❌ Not supported
```
```typescript
chalk.redBright('text') // ❌ Not supported
chalk.greenBright('text') // ❌ Not supported
chalk.yellowBright('text') // ❌ Not supported
// Only blueBright is supported (as alias for cyan)
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.