代码是:
let redColor = "\u{001B}[0;31m" var message = "Some Message" print(redColor + message) //This doesnt work print("\(redColor)\(message)" //This also doesnt work
输出看起来像这样:
[0;31mSome Message
我也读过这篇文章:Color ouput with Swift command line tool,它似乎不起作用.
我不想使用库.
如今,Xcode调试控制台不支持着色.
原文链接:https://www.f2er.com/swift/319150.html