getGuaka / Colorizer

A Swift package that helps adding colors to strings written to the terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colorizer 🎨 Build Status

Colorizer helps adding colors to strings written to the terminal.

Usage

Colorizer helps styling the strings before printing them to the terminal. You can change the text color, the text background and the text style. Colorizer works by extending String struct to add styling to it.

To change the text color, use either string.f or string.foreground:

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

To change the text background color, use either string.b or string.background:

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

To change the text background style, use either string.s or string.style:

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

You can compose foreground, background, and style:

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

Installation

Swift Package Manager

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

License

MIT

About

A Swift package that helps adding colors to strings written to the terminal.

License:MIT License


Languages

Language:Swift 100.0%