Color
extras.scala.io.syntax
extras-scala-io
provides syntax
to use scala.io.AnsiColor
easily (The missing ones will be added later).
import extras.scala.io.syntax.color._
import extras.scala.io.syntax.color._
"Hello".blue
// res2: String = "\u001b[34mHello\u001b[0m"
"Hello".red
// res3: String = "\u001b[31mHello\u001b[0m"
"Hello".green
// res4: String = "\u001b[32mHello\u001b[0m"
"Hello".bold
// res5: String = "\u001b[1mHello\u001b[0m"
"Hello".underlined
// res6: String = "\u001b[4mHello\u001b[0m"
println("Hello".blue)
// [34mHello[0m
println("Hello".red)
// [31mHello[0m
println("Hello".green)
// [32mHello[0m
println("Hello".bold)
// [1mHello[0m
println("Hello".underlined)
// [4mHello[0m
You can also chain them like this.
import extras.scala.io.syntax.color._
println("Hello".blue)
// [34mHello[0m
println("Hello".blue.bold)
// [1m[34mHello[0m[0m
println("Hello".blue.bold.underlined)
// [4m[1m[34mHello[0m[0m[0m
println("Hello".underlined.bold.blue)
// [34m[1m[4mHello[0m[0m[0m