mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Rework color option
Rework the color option to support setting ANSI color code values ranging from 0..255 or "none" for no color or "list" to print a list of available ANSI colors codes. Also, disables color when piping.
This commit is contained in:
parent
2519e2081a
commit
46b5783789
8 changed files with 67 additions and 32 deletions
|
|
@ -70,6 +70,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
stdout_configure();
|
||||
}
|
||||
else
|
||||
{
|
||||
// No color when piping
|
||||
option.color = -1;
|
||||
}
|
||||
|
||||
/* Add log exit handler */
|
||||
atexit(&log_exit);
|
||||
|
|
@ -78,8 +83,8 @@ int main(int argc, char *argv[])
|
|||
if (option.log)
|
||||
log_open(option.log_filename);
|
||||
|
||||
/* Enable ANSI text formatting (colors etc.) */
|
||||
print_enable_ansi_formatting();
|
||||
/* Initialize ANSI text formatting (colors etc.) */
|
||||
print_init_ansi_formatting();
|
||||
|
||||
/* Print launch hints */
|
||||
tio_printf("tio v%s", VERSION);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue