Colorizer

master

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

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

Description

  • Swift Tools 4.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed Mar 13 2024 00:42:58 GMT-0900 (Hawaii-Aleutian Daylight Time)