简体   繁体   English

C / Objective-C中的ANSI颜色提取库

[英]ANSI Color extraction library in C/Objective-C

I'm seeking a library, or bit of code I can incorporate into a Cocoa project where I can turn a stream of text with ansi color control codes into an attributed string. 我正在寻找一个库或一些代码,我可以将它们合并到一个Cocoa项目中,我可以将带有ansi颜色控制代码的文本流转换为属性字符串。 There are many projects that do this, but having examined their code they're either messy or overly complex. 有许多项目可以做到这一点,但是在检查了他们的代码后,他们要么是混乱的,要么过于复杂。 Has anyone an idea of a simple piece of code, or library, or framework I can use to do this simple task? 有没有人知道我可以用来做这个简单任务的简单代码,库或框架?

I've written a class (called ANSIEscapeHelper ) to translate between NSStrings that contain ANSI escape sequences and similarly formatted NSAttributedStrings . 我编写了一个类(称为ANSIEscapeHelper )来在包含ANSI转义序列和类似格式的NSAttributedStrings NSStrings之间进行转换。 It's released under the MIT License. 它是在MIT许可下发布的。

I'm not aware of a library or framework. 我不知道库或框架。 I'd think doing so wouldn't be too hard — I'm new to Cocoa, but I'd probably go the regexen processing path. 我认为这样做不会太难 - 我是Cocoa的新手,但我可能会去regexen处理路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM