This is a small scala "util" library, which will hopefully grow over time.
- AnsiPrint - ansi styled outputs for your strings
- Java 1.6 or greater
- SBT 0.12.2 or greater if you want to build from source
Add these lines to your SBT build file:
resolvers += Resolver.sonatypeRepo("releases") // optional, but quicker
libraryDependencies += "com.github.agilesteel" % "spells_2.10" % "1.4"Here is an example of AnsiPrint in action:
package myproject
import spells._
object Ansi extends App {
println("white")
println("green")(Green)
println("green".green)
println(1337.cyan)
println("magenta".magenta)(Green)
println("yellow".yellow + "green".green + "yellow".yellow)(Yellow)
println("yellow" + "green".green)(Yellow)
println("yellow".yellow + "green")(Green)
println("yellow" + "green".green + "yellow")(Yellow)
println("yellow".yellow + "green" + "yellow".yellow)(Green)
println("yellow" + "green".green + "yellow".yellow)(Yellow)
println("yellow".yellow + "green".green + "yellow")(Yellow)
println("yellow" + "red".red + "yellow" + "green".green + "yellow")(Yellow)
}
object UsingCustomStyles extends App {
val customStyle = "someStyle".toAnsiStyle
println("styled" in customStyle)
}
object OverridingDefaultStyle extends App {
implicit val defaultStyle = Yellow
println("yellow" + "red".red + "yellow" + "green".green + "yellow")
}
object OverridingDefaultStyleWithCustomStyle extends App {
implicit val defaultStyle = "someStyle".toAnsiStyle
println("styled")
}