ANSI Escape on Touch Bar

Hi everyone!
I'm using BTT since 2020.
Now I have a simple question:
It's possible to use ANSI Escape on Touch Bar?
I have last two lines, picked from a .log file, on Touch Bar.
I want to "color" some words using ANSI Escape.
It's possible?
Using that script on a simple bash shell, it works, I can see the color.
It doesn't work on Touch Bar.



if [ -e "$file" ]; then
    tail -n 2 "$file" | sed -E 's/\[1;31m//g; s/\[1;32m//g; s/\[1;33m//g; s/\[0m//g; s/\[SUCCESS\]/'"$(echo -e '\033[32m')"'&'"$(echo -e '\033[0m')"/g''
    echo "$file not found."

Thanks for the answers!

MacBook Pro M1
Sonoma 14.2.1
BTT 4.356

no, that will not work (I think these only work on terminals).

You can use html to color specific words.

<html><span style="color: red">test</span></html>

I think there was an inaccuracy in what I wrote.
That script is used in a Shell Script/Task Widget on Touch Bar section.
So, how can I use your solution? I don't understand :frowning:

still, only a terminal renderer would understand these escape sequences.

You would need to adapt your script to return HTML instead of these escape sequences.

1 Like