← 返回命令列表

Linux command

chalk-cli 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Style text with color

chalk red "Hello World"

Apply multiple styles

chalk red bold "Important text"

Use template syntax

chalk -t "{red.bold Unicorns} are {blue fun}"

Read from stdin

echo "text" | chalk --stdin green

Negate a style in template

chalk -t "{red text {~red normal}}"

Output without newline

chalk -n yellow "No newline"

Demo all styles

chalk --demo

说明

chalk-cli is a command-line tool for styling terminal strings with colors and formatting. It wraps the popular Node.js Chalk library, providing access to its styling capabilities from shell scripts and the command line. Styles include foreground and background colors (standard and bright variants), as well as text modifiers like bold, dim, italic, underline, inverse, and strikethrough. Multiple styles can be combined, and the template syntax allows applying different styles to different parts of a single string. Input can come from command arguments or stdin, making it useful in shell pipelines for highlighting output or building colorful CLI interfaces.

参数

-t, --template
Use template syntax for nested styles
--stdin
Read input from stdin
-n, --no-newline
Don't emit newline after output
--demo
Show demo of all available styles
-c, --color
Force color support

FAQ

What is the chalk-cli command used for?

chalk-cli is a command-line tool for styling terminal strings with colors and formatting. It wraps the popular Node.js Chalk library, providing access to its styling capabilities from shell scripts and the command line. Styles include foreground and background colors (standard and bright variants), as well as text modifiers like bold, dim, italic, underline, inverse, and strikethrough. Multiple styles can be combined, and the template syntax allows applying different styles to different parts of a single string. Input can come from command arguments or stdin, making it useful in shell pipelines for highlighting output or building colorful CLI interfaces.

How do I run a basic chalk-cli example?

Run `chalk red "Hello World"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --template do in chalk-cli?

Use template syntax for nested styles