| name | chalk-styling-system |
| description | Create consistent chalk-based color and styling system for CLI output with themes, semantic colors, and formatting utilities. |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| graph | {"domains":["domain:software-engineering"],"specializations":["specialization:cli-mcp-development"],"skillAreas":["skill-area:cli-design","skill-area:command-line-interface-tools"],"roles":["role:backend-engineer","role:platform-engineer"],"workflows":["workflow:feature-development"],"topics":["topic:developer-experience"]} |
Chalk Styling System
Create consistent chalk-based styling for CLI output.
Capabilities
- Create color theme systems
- Define semantic color utilities
- Set up text formatting helpers
- Implement conditional styling
- Create box and border utilities
- Generate styling documentation
Usage
Invoke this skill when you need to:
- Create consistent CLI color schemes
- Define semantic output styling
- Build formatting utilities
- Support multiple themes
Inputs
| Parameter | Type | Required | Description |
|---|
| language | string | Yes | Target language |
| theme | object | No | Custom color theme |
| utilities | array | No | Formatting utilities needed |
Generated Patterns
TypeScript Styling System
import chalk, { ChalkInstance } from 'chalk';
export interface Theme {
primary: string;
secondary: string;
success: string;
warning: string;
error: string;
info: string;
muted: string;
}
const defaultTheme: Theme = {
primary: '#3498db',
secondary: '#9b59b6',
success: '#2ecc71',
warning: '#f39c12',
error: '#e74c3c',
info: '#00bcd4',
muted: '#95a5a6',
};
export function createTheme(theme: Partial<Theme> = {}): {
primary: ChalkInstance;
secondary: ChalkInstance;
success: ChalkInstance;
warning: ;
: ;
: ;
: ;
} {
t = { ...defaultTheme, ...theme };
{
: chalk.(t.),
: chalk.(t.),
: chalk.(t.),
: chalk.(t.),
: chalk.(t.),
: chalk.(t.),
: chalk.(t.),
};
}
style = ();
log = {
: .(style.() + msg),
: .(style.() + msg),
: .(style.() + msg),
: .(style.() + msg),
: .(style.() + msg),
};
format = {
: chalk.,
: chalk.,
: chalk.,
: chalk.,
: chalk.,
: chalk..(),
: chalk..(text) + ,
};
(): {
lines = content.();
maxWidth = .(...lines.( l.), options?.?. || );
padding = options?. || ;
borderColor = options?. || ;
border = chalk.(borderColor);
horizontalBorder = (.(maxWidth + padding * + ));
emptyLine = () + .(maxWidth + padding * ) + ();
: [] = [];
(options?.) {
titlePadding = .((maxWidth + padding * - options..) / );
result.(
() +
(.(titlePadding)) +
+
(.(maxWidth + padding * - titlePadding - options.. - )) +
()
);
} {
result.(() + horizontalBorder.(, -) + ());
}
( i = ; i < padding; i++) {
result.(emptyLine);
}
( line lines) {
result.(
() +
.(padding) +
line.(maxWidth) +
.(padding) +
()
);
}
( i = ; i < padding; i++) {
result.(emptyLine);
}
result.(() + horizontalBorder.(, -) + ());
result.();
}
(): {
headerColor = chalk.(options?. || ).;
colWidths = headers.(
.(h., ...rows.( (r[i] || ).))
);
headerRow = headers
.( (h.(colWidths[i])))
.();
separator = colWidths.( .(w)).();
dataRows = rows.(
row.( (cell || ).(colWidths[i])).()
);
[headerRow, separator, ...dataRows].();
}
Dependencies
{
"dependencies": {
"chalk": "^5.0.0"
}
}
Target Processes
- cli-output-formatting
- error-handling-user-feedback
- cli-application-bootstrap