PrettyColors

Carthage Compatibility Swift Package Manager Compatibility CocoaPods Version License Platform

描述

PrettyColors 是一个 Swift 库,用于在终端中设置文本样式和颜色。该库输出 ANSI 转义码,并符合 ECMA 标准 48

示例

import PrettyColors

let redText: String = Color.Wrap(foreground: .red).wrap("A red piece of text.")
println(redText)

Color.Wrap(foreground: .yellow, style: .bold)
Color.Wrap(foreground: .green, background: .black, style: .bold, .underlined)

// 8-bit (256) color support
Color.Wrap(foreground: 114)
Color.Wrap(foreground: 114, style: .bold)

更多示例可以在测试中找到。

安装

Carthage

将以下内容添加到您的 Cartfile 中

github "jdhealy/PrettyColors"

CocoaPods

将以下内容添加到您的 Podfile

pod 'PrettyColors', :git => 'https://github.com/jdhealy/PrettyColors'

您还需要确保您选择使用框架

use_frameworks!

然后使用 CocoaPods 0.36 或更高版本运行 pod install

灵感来源

许可证

PrettyColors 在 MIT 许可证下发布。 有关详细信息,请参阅 LICENSE.md