-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor_en.1
More file actions
166 lines (142 loc) · 3.06 KB
/
Copy pathcolor_en.1
File metadata and controls
166 lines (142 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
.TH COLOR 1 "April 2026" "color" "User Commands"
.SH NAME
color \- colorize text from standard input using ANSI terminal escape sequences
.SH SYNOPSIS
.B color
.RB [ \-b ]
.RB [ \-i ]
.RB [ \-f ]
.I color
.SH DESCRIPTION
.B color
writes an ANSI color escape sequence to standard output, then copies data
from standard input to standard output, and finally restores the terminal's
normal color mode.
It is intended for use in pipes, shell scripts, or other command-line setups
where text output should be displayed in color. The program accepts one color
argument and optionally enables bold, high-intensity, or forced color output.
.SH OPTIONS
.TP
.B \-b
Use bold color output.
.TP
.B \-i
Use high-intensity color output.
.TP
.B \-f
Force color output even when standard output is not a TTY. By default,
.B color
only emits escape sequences when stdout is connected to a terminal. This
option overrides that check, which is useful when piping output to a file
or another program that should retain the color codes.
The options may be combined. For example,
.B \-bi
and
.B \-ib
both request bold high-intensity output.
.B \-bif
requests bold high-intensity output with forced TTY mode.
.SH ARGUMENTS
.TP
.I color
The color name to use. Supported values are:
.RS
.PP
.B black
.br
.B red
.br
.B green
.br
.B yellow
.br
.B blue
.br
.B pink
.br
.B cyan
.br
.B white
.br
.B reset
.RE
The special value
.B reset
emits the reset escape sequence.
.SH OPERATION
After parsing its command-line arguments,
.B color
selects the appropriate ANSI escape sequence for the requested color and mode.
It writes that sequence to standard output, copies the incoming byte stream
from standard input to standard output in blocks, and restores the terminal's
normal color setting at the end.
Color output is suppressed when stdout is not a TTY, unless
.B \-f
is specified.
.SH EXIT STATUS
.TP
.B 0
Successful execution.
.TP
.B 1
Invalid command-line usage, such as a missing color name, too many arguments,
an unknown color, or an unsupported option. The program prints a usage message
to standard error before exiting.
.SH EXAMPLES
Print red text:
.PP
.nf
echo "Hello, world" | color red
.fi
.PP
Print bold green text:
.PP
.nf
echo "Success" | color \-b green
.fi
.PP
Print high-intensity yellow text:
.PP
.nf
echo "Warning" | color \-i yellow
.fi
.PP
Print bold high-intensity blue text:
.PP
.nf
echo "Information" | color \-bi blue
.fi
.PP
Force color codes into a file:
.PP
.nf
echo "Information" | color \-f blue > output.txt
.fi
.PP
Reset terminal formatting:
.PP
.nf
color reset
.fi
.SH DIAGNOSTICS
The program prints the following usage message on invalid input:
.PP
.nf
usage:color [-b] [-i] [-f] <color>
color := black|red|green|yellow|blue|pink|cyan|white|reset
.fi
.SH NOTES
This program uses ANSI terminal escape sequences. It is therefore mainly useful
in terminals that support ANSI color output.
By default, if the output is redirected to a file or pipe, the escape sequences
are suppressed. Use
.B \-f
to force them.
.SH FILES
None.
.SH AUTHOR
Christian Forler
.SH SEE ALSO
.BR printf (1),
.BR echo (1),
.BR tput (1)