Colorizer 🎨 Build Status

Colorizer 帮助为写入终端的字符串添加颜色。

用法

Colorizer 帮助在字符串打印到终端之前对其进行样式设置。您可以更改文本颜色、文本背景和文本样式。Colorizer 通过扩展 String 结构体来为其添加样式。

要更改文本颜色,请使用 string.fstring.foreground

print("Red String".f.Red)
print("Blue String".foreground.Blue)

要更改文本背景颜色,请使用 string.bstring.background

print("I have a white background".b.White)
print("My background color is green".background.Green)

要更改文本背景样式,请使用 string.sstring.style

print("I am a bold string".s.Bold)
print("I have an underline".style.Underline)

您可以组合前景色、背景色和样式。

print("I am an underlined red on white string".s.Underline.f.Red.b.White)

安装

Swift Package Manager

.package(url: "https://github.com/getGuaka/Colorizer.git", from: "0.0.0"),

许可证

MIT