From Scala 2.11.4 onwards you can get a colored REPL by invoking scala -Dscala.color
. My question is whether it is possible to get the same colored REPL when I call sbt console
within my SBT project?
starting from scala 2.12.2, the repl is colored by default; so you just need to set the scalaVersion
property in ~/.sbt/user.sbt
file:
scalaVersion := "2.12.2"
In the same way:
sbt -Dscala.color console
This also works if you just invoke sbt -Dscala.color
and then later jump into console
.
Put this into your ~/.sbt/0.13/user.sbt:
initialize ~= { _ =>
val ansi = System.getProperty("sbt.log.noformat", "false") != "true"
if (ansi) System.setProperty("scala.color", "true")
}
Create a ~/.sbt/0.13/colour.sbt
with:
initialize ~= (_ => if (ConsoleLogger.formatEnabled) sys.props("scala.color") = "true")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With