Reputation: 8996
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?
Upvotes: 12
Views: 2638
Reputation: 649
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"
Upvotes: 3
Reputation: 6102
Create a ~/.sbt/0.13/colour.sbt
with:
initialize ~= (_ => if (ConsoleLogger.formatEnabled) sys.props("scala.color") = "true")
Upvotes: 1
Reputation: 2935
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")
}
Upvotes: 13
Reputation: 5974
In the same way:
sbt -Dscala.color console
This also works if you just invoke sbt -Dscala.color
and then later jump into console
.
Upvotes: 7