Add color configuration support

This commit is contained in:
Martin Lund 2022-03-11 16:09:21 +01:00
parent 410fc8bffe
commit e81e76473a
2 changed files with 8 additions and 1 deletions

View file

@ -167,7 +167,7 @@ Sections can be used to group settings and their names are only used for readabi
tio will try to match the user input to a section pattern to get the tty and other options. tio will try to match the user input to a section pattern to get the tty and other options.
.TP .TP
The following options are available: The following configuration file options are available:
.IP "\fBpattern" .IP "\fBpattern"
pattern matching user input. This pattern can be an extended regular expression with a single group. pattern matching user input. This pattern can be an extended regular expression with a single group.
@ -197,6 +197,8 @@ Prefix each new line with a timestamp
Set log filename Set log filename
.IP "\fBmap" .IP "\fBmap"
Map special characters on input or output Map special characters on input or output
.IP "\fBcolor"
Colorize tio text using ANSI color code ranging from 0 to 255.
.SH "CONFIGURATION EXAMPLES" .SH "CONFIGURATION EXAMPLES"
@ -210,6 +212,7 @@ A Typical section used as a short-hand would be defined as such:
pattern=ftdi pattern=ftdi
baudrate=115200 baudrate=115200
tty=/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0 tty=/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FTGQVXBL-if00-port0
color=11
.ec .ec
.fi .fi
.RE .RE

View file

@ -146,6 +146,10 @@ static int data_handler(void *user, const char *section, const char *name,
asprintf(&c->map, "%s", value); asprintf(&c->map, "%s", value);
option.map = c->map; option.map = c->map;
} }
else if (!strcmp(name, "color"))
{
option.color = atoi(value);
}
return 0; return 0;
} }