0

I would like to use escape to represent control code to build a message with terminal color.

Can I use something like...

"\u001b[93m" or "\x1b[93m"

?

Ken White
  • 123,280
  • 14
  • 225
  • 444
S2000Erwin
  • 11
  • 1

2 Answers2

0

Currently I am using this method:

val newargs = append-all([to-string(to-char(27)) CGREEN msg to-string(to-char(27)) CEND])

to-string(to-char(27)) is too clumsy. I am sure there is a better method.

S2000Erwin
  • 11
  • 1
0

You can see how this library implements terminal colors as a reference

  • Thanks, the library is very useful, but it is not exactly the answer to my question. I see that val ESCAPE = to-char(0x1B) is used. I wanted an escape method on a String. I notice "\nABC\n" works but it seems that "\x1bABC" does not. – S2000Erwin Apr 01 '22 at 22:24
  • I don't think that is currently supported in stanza, only a subset of common escape sequences are handled by the parser. – Mike Hilgendorf Apr 04 '22 at 15:53