mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +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
|
|
@ -166,7 +166,23 @@ static int data_handler(void *user, const char *section, const char *name,
|
|||
}
|
||||
else if (!strcmp(name, "color"))
|
||||
{
|
||||
if (!strcmp(value, "list"))
|
||||
{
|
||||
// Ignore
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(value, "none"))
|
||||
{
|
||||
option.color = -1; // No color
|
||||
return 0;
|
||||
}
|
||||
|
||||
option.color = atoi(value);
|
||||
if ((option.color < 0) || (option.color > 255))
|
||||
{
|
||||
option.color = -1; // No color
|
||||
}
|
||||
}
|
||||
else if (!strcmp(name, "socket"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue