0

I'm trying to print colored text in the console in Xcode with XcodeColors (works on Xcode 8 when unsigned) using NSLog.

This doesn't work:

NSLog("\u{001b}[fg255,0,0;Test\u{001b}[;")

I get \^[[fg255,0,0;Test\^[[; in the console.

However, these do work:

print("\u{001b}[fg255,0,0;Test\u{001b}[;") NSLog("\u{001b}[fg255,0,0;Test\u{001b}[;")

i.e. using print or adding a unicode symbol to the string causes it to work. How can I get this working without doing either of those?

Nick
  • 3,958
  • 4
  • 32
  • 47
  • What's wrong with `print`? – Losiowaty Apr 16 '17 at 22:58
  • 1
    I want the date/app name so it matches the indent of other logs. I'm sure I could achieve this other ways but I thought there must be a simple solution – Nick Apr 16 '17 at 23:01
  • 1
    Possible duplicate of [Any way to print in color with NSLog?](https://stackoverflow.com/questions/9005769/any-way-to-print-in-color-with-nslog) – Konrad Piascik Oct 19 '18 at 13:13

0 Answers0