To use TTS - Terminal Text Style in a SwiftPM project, add it as a package dependency to your Package.swift:
dependencies: [
.package(url: "https://github.com/andrsem/tts.git", from: "1.0.0")
]Then, adding the Terminal Text Style module to your target dependencies:
.target(
name: "MyTarget",
dependencies: [
.product(name: "TTS", package: "TTS")
]
)print("Red foreground".fg(.red))
print("Yellow bg, black fg".fg(.black).bg(.yellow))print("Extended fg (135)".fg(135))
print("Extended bg (244)".bg(244))print("RGB color fg (120, 11, 250)".fg(.rgb(120, 11, 250)))
print("HSB color fg (320, 0.6, 0.8)".fg(.hsb(320, 0.6, 0.8)))
print("HEX color fg (#BFBFBF)".fg(.hex("#BFBFBF")))print("RGB color bg (120, 11, 250)".bg(.rgb(120, 11, 250)))
print("HSB color bg (320, 0.6, 0.8)".bg(.hsb(320, 0.6, 0.8)))
print("HEX color bg (#BFBFBF)".bg(.hex("#BFBFBF")))let styledStr = "Styled fg and bg; bold, italic"
.fg(.blue)
.bg(.rgb(255, 200, 0))
.styles(.bold, .italic)
print(styledStr)let resetedStr =
"bold underline, "
.fg(.red, reset: .manual)
.styles(.bold, .underline, reset: .manual)
+ "bold, ".reset(.underline, .before)
+ "red, ".reset(.bold, .before).reset(.fgColor)
+ "normal"
print(resetedStr)





