Colorize your terminal output with ANSI Colors
Simply use it on any String
.
public func textColor(_ color: ANSIColor) -> String {}
public func backgroundColor(_ color: ANSIColor) -> String {}
public func style(_ style: ANSIStyle) -> String {}
Example:
"This " +
"line ".textColor(.Yellow) +
"is " +
"mixed".backgroundColor(.Blue)
chaining possible
"Lorem Ipsum".style(.Bold)
.textColor(.Red)
.backgroundColor(.White)
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- White
- Bold
- Italic
- Underline
- Inverse
- Blink
- Strikethrough
You can take a look at the Sources/main.swift
to. This file is no included in the compiled package!
Add a dependency to your Package.swift
import PackageDescription
let package = Package(
name: "YourPackage",
dependencies: [
.Package(url: "[email protected]:somekindofcode/SwiftANSI.git", majorVersion: 1)
]
)