Page 1 of 1

CoolTerm ANSI color codes support

Posted: Fri Apr 07, 2023 1:53 am
by miniol
Hi,
Thanks for the great app. I use the CoolTerm for some time and so far, this is the best terminal app ever. It has almost all the features I need.
The only thing I miss is support for terminal text coloring.
I've found the option to filter ANSI escape sequences (and this is very useful) but I cannot find any option to apply the ANSI color codes to the terminal text.
In my use case, I have a device that continuously sends many log stings to the serial port. It uses ANSI color codes to mark info, warnings and errors in different colors. This would be much easier to notice some strange behavior within a "wall of text" when they are marked in a different color.

Do you consider adding such functionality to your application?

Re: CoolTerm ANSI color codes support

Posted: Fri Apr 07, 2023 3:57 pm
by roger
Hi,

thanks for the kudos.

unfortunately, the TextArea control CoolTerm uses to display plain text is not capable of multiple text formatting. I.e. any color setting applies to all the text in the control. Being able to display portions of text in a different color would require the development of a custom text display control, which is not going to happen for the foreseeable future.

Roger

Re: CoolTerm ANSI color codes support

Posted: Fri Apr 07, 2023 6:36 pm
by roger
After looking into this a bit further, I think it MAY be possible to support a VERY LIMITED set of ANSI color and formatting for sections of text. The control can potentially support, bold, italic, underline formatting as well as limited color support (i.e. the basic colors) per this list. So, basically, ANSI sequences formatted like this:

Code: Select all

ESC[1;34;{...}m
where the codes vary from 0 to 39.

Can you post an example of text you receive from your device, including the ANSI codes it includes?

Re: CoolTerm ANSI color codes support

Posted: Mon Apr 24, 2023 10:22 am
by bltsndwch
Not OP, though I would also appreciate ANSI color support!

Here's an example of a text received, where faults (0x0 or 0x41) are color coded green or yellow.

Code: Select all

Channel		TC Temp		Cold Junc Temp	TC Faults
1		24.98C		25.45C		[92m0x0[0m
2		1372.05C	25.59C		[93m0x41[0m
3		1372.05C	25.59C		[93m0x41[0m
4		25.27C		25.55C		[92m0x0[0m
not captured in the log file is the escape codes. What is actually being received is

Code: Select all

"\033[92m0x0\033[0m"
and

Code: Select all

"\033[93m0x41\033[0m"
. (setting a color, the text, then a reset)

In my application I also have control in how the sending device format's its messages, so I could change the sent serial data to better conform to what CoolTerm would need if required.

Re: CoolTerm ANSI color codes support

Posted: Mon Apr 24, 2023 1:52 pm
by roger
bltsndwch wrote: Mon Apr 24, 2023 10:22 am Not OP, though I would also appreciate ANSI color support!

Here's an example of a text received, where faults (0x0 or 0x41) are color coded green or yellow.

Code: Select all

Channel		TC Temp		Cold Junc Temp	TC Faults
1		24.98C		25.45C		[92m0x0[0m
2		1372.05C	25.59C		[93m0x41[0m
3		1372.05C	25.59C		[93m0x41[0m
4		25.27C		25.55C		[92m0x0[0m
not captured in the log file is the escape codes. What is actually being received is

Code: Select all

"\033[92m0x0\033[0m"
and

Code: Select all

"\033[93m0x41\033[0m"
. (setting a color, the text, then a reset)

In my application I also have control in how the sending device format's its messages, so I could change the sent serial data to better conform to what CoolTerm would need if required.
I got something working by switching the textArea control used to display text to StyledText mode and using some other hacks to parse the receive data so that it the whole thing is not excruciatingly slow. It works ok, and it can handle all the color modes and a few formatting sequences (bold, italic, underline), but it won't be as snappy as when you just tell CoolTerm to filter out all ANSI escape sequences. I will send you an e-mail at the address you provided when you registered the forum account with the link to a build you can try out.

Roger

Re: CoolTerm ANSI color codes support

Posted: Mon Jan 22, 2024 11:39 pm
by farhan ahmed
Hello,
i have fond of CoolTerm for quite some time and have been looking for a solution for ANSI style encoding support, if you have worked out a solution to this than please share it so i can see the rainbow in CoolTerm.

Re: CoolTerm ANSI color codes support

Posted: Tue Jan 23, 2024 2:29 pm
by roger
farhan ahmed wrote: Mon Jan 22, 2024 11:39 pm Hello,
i have fond of CoolTerm for quite some time and have been looking for a solution for ANSI style encoding support, if you have worked out a solution to this than please share it so i can see the rainbow in CoolTerm.
Hi,
the latest version (v2.1.0) supports this now. You can download it here: https://freeware.the-meiers.org