Is there something special I need to do do use ANSI codes in Nim? This works in Python "\033[32mtesting\033[00m"but in Nim "![32mtesting![00m"gets written to stdout instead. I assume it has to do with the compiler warning "Warning: octal escape sequences do not exist; leading zero is ignored [OctalEscape]"but I am not sure what the compiler is trying to say here; they don't exist or they don't exist in Nim?
The longer answer is that Nim is just passing through bytes; the terminal driver deals w/ Ansi escape codes. \eand \x1bare valid ways to get the control byte in Nim, but it doesn't accept escape sequences in octal, per the error message.
Well it says "octal escape sequences", it doesn't say anything about ANSI escape sequences. Also, terminal.nimis part of the stdlib, you don't need to mess with them yourself and as a bonus your program will work on Windows too.
Yes I use the terminal library a lot but as far as I know it doesn't provide fine grained control for just (efficiently) colorizing a portion of a string.