Node-RED Debug Sidebar Console Printing Colored Text

Hello,

I am looking for a way for the Node-RED debug sidebar tab to be able to print colored text instead of in code form as shown in the picture below.


These message payloads are coming from a serial connection between Node-Red to a Linux device during booting.

I've tried installing chalk and colors but it doesn't work the way I wanted. Maybe I am missing something in the process.

Appreciate any help given!

Chalk is for the log output.
If I remember correctly the debug output cannot be coloured.

Yes the debug sidebar is rendered as html - so doesn't handle ansi codes.. but also to prevent code injection we don't interpret tags either.

If you really want to monitor those with colour, a custom Node-RED logging function would do it. Quite a lot of work for potentially little benefit though. Maybe pass through a change or function node before sending to debug and filtering the control codes out of the text.

you can set the console output to use colours by the settings.js debugUseColors: true, option - but this only does the console output... not the debug sidebar.

What I'm trying to achieve is to extract data coming through the serial port after executing a Linux command and processing it through node-red functions. Right now, it is quite difficult to extract the data due to the weird symbol.

For example, based on the picture above, I'm executing memtester command and wanted to extract the OK and process it in the function node and display it on the dashboard if the test is passed or failed. I can't specify the location of OK because when testing different amounts of memory the location of OK will be different.

By setting debugUseColors: true in the setting.js, will it remove the symbols and tag? Or is there any other suggestion on how to approach this? The color is not the priority, if I can filter the weird symbols/color tag to have cleaner data input that would be great.

Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.