terminal-output-styling
БесплатноБез исполняемых скриптовНе проверенHuman-facing terminal output: colour gating (TTY, NO_COLOR, FORCE_COLOR), semantic palette, layout. Use when styling script, CLI, or TUI output.
от laurigates★ 61 звезда на GitHubОб этом скилле
Terminal Output Styling
How to style output that a person reads in a terminal — shell scripts, CLIs, dev tools, interactive prompts, TUIs — so it scans quickly on a terminal and stays plain text everywhere else.
When to Use This Skill
| Use this skill when… | Use instead when… |
|---|---|
| A person reads the output in a terminal: progress, summaries, prompts, error lines | An agent or orchestrating script parses it — emit === SECTION === / KEY=VALUE / STATUS= with no colour (this marketplace's structured-script-output contract) |
| Deciding when to emit colour and which colour means what | Writing the script itself: quoting, traps, portability — tools-plugin:shell-expert |
| Laying out blocks, aligned fields, prompts and a closing tally | Exposing a module through CLI subcommands and smoke-testing it — tools-plugin:cli-smoke-recipes |
One script can serve both readers: style for the TTY, and keep the piped form plain so tests, logs and agents read it unchanged.
When to Colour
| Condition | Colour | Source |
|---|---|---|
NO_COLOR set and non-empty |
off — wins over FORCE_COLOR / CLICOLOR_FORCE |
no-color.org |
Explicit flag (--color=always|never) |
as requested — no-color.org lets per-invocation flags override NO_COLOR |
no-color.org |
FORCE_COLOR or CLICOLOR_FORCE set (non-empty / non-0) |
on, even when piped | de-facto convention |
stdout is a TTY ([ -t 1 ]) |
on | default |
| otherwise (pipe, file, CI log) | off | default |
- Decide stderr separately (
[ -t 2 ]) when error lines go there:cmd 2>err.logleaves stdout on the terminal but stderr in a file. TERM=dumbis a reasonable extra "off" signal; several libraries check it.- Piped output stays plain, so
grep, tests and agents never see\033[.
Semantic Palette
One meaning per colour, and every colour paired with a symbol and a word, so the line still reads with colour off and for colour-blind readers.
| Colour | Meaning | Paired marker |
|---|---|---|
| green | success, applied | ✓ applied |
| red (on stderr) | error, failed | ✗ error: |
| yellow | needs attention, warning, pending, skipped | → skipped, 3 pending |
| dim | metadata: links, dates, trace info, declined | – declined |
| bold | headings, prompt keys, tally label | ▸ item, Done: |
| cyan | identifiers: names, IDs, paths in headings | ▸ 2026-11-30-cleanup |
Use the 8 basic ANSI colours (30–37) so the user's terminal theme picks the
shade; 256-colour and truecolor codes ignore it.
Layout
| Element | Pattern |
|---|---|
| Block per item | blank line, then a bold heading (▸ name) |
| Body | indented under the heading (3 spaces) |
| Label/value rows | padded label column: printf ' %-8s %s\n' "$label" "$value" |
| Position in an interactive loop | [n/total] dimmed after the heading |
| Prompt | bold question, each key bold in its outcome's colour: Apply? y yes n no s skip › |
| Closing line | one-line tally: Done: 1 applied · 0 declined · 1 skipped |
Rendered (colour off):
▸ 2026-11-30-uninstall-foo [1/2]
Uninstall the global foo tool, now installed per project.
found foo 1.2.3 (uv tool)
commit https://github.com/owner/repo/commit/abc1234
expires 2027-05-30
Apply? y yes n no, never ask again s skip for now › y
✓ applied
Done: 1 applied · 0 declined · 1 skipped
Bash Mechanics
Define the colour variables once; when colour is off they are empty strings, so call sites never branch.
if [ -z "${NO_COLOR:-}" ] && { [ -n "${FORCE_COLOR:-}" ] || [ -t 1 ]; }; then
C_BOLD=$'\033[1m' C_DIM=$'\033[2m' C_RED=$'\033[31m' C_GREEN=$'\033[32m'
C_YELLOW=$'\033[33m' C_CYAN=$'\033[36m' C_RESET=$'\033[0m'
else
C_BOLD='' C_DIM='' C_RED='' C_GREEN='' C_YELLOW='' C_CYAN='' C_RESET=''
fi
ok() { printf '%s✓%s %s\n' "$C_GREEN" "$C_RESET" "$*"; }
err() { printf '%s✗ error:%s %s\n' "$C_RED" "$C_RESET" "$*" >&2; }
field() { printf ' %s%-8s%s %s\n' "${3:-$C_DIM}" "$1" "$C_RESET" "$2"; }
| Practice | Why |
|---|---|
$'\033[…m' ANSI-C quoting |
Stores the real escape byte; works in bash 3.2 (macOS /bin/bash) |
printf '%s…' "$C_X", never echo -e |
echo -e differs across shells and sh; printf is portable and keeps data out of the format string |
Pass colours as %s arguments |
A % in user data cannot corrupt the format |
Padding with %-8s on the label only |
Escape codes count toward printf width; keep them outside the padded field |
tput setaf only when terminfo lookup matters |
Exotic terminals; it forks a process per call and fails under TERM=dumb or no TERM |
CLICOLOR_FORCE |
Add a [ -n "${CLICOLOR_FORCE:-}" ] alternative beside the FORCE_COLOR test if your users set it |
Other Languages
Prefer the ecosystem library over hand-written escapes. Their environment
handling differs — check the column before relying on NO_COLOR alone.
| Language | Library | Env handling
Установить terminal-output-styling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGrepGlobFAQ
Что делает скилл terminal-output-styling?
Human-facing terminal output: colour gating (TTY, NO_COLOR, FORCE_COLOR), semantic palette, layout. Use when styling script, CLI, or TUI output.
Как установить скилл terminal-output-styling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл terminal-output-styling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic