How to detect ANSI and color support at the SBT terminal

You may try to use Terminal.console.isAnsiSupported and Terminal.console.isColorEnabled like for example:

initialize := {
  if (sbt.internal.util.Terminal.console.isAnsiSupported && sbt.internal.util.Terminal.console.isColorEnabled) {
    println("My fancy ANSI long string with color")
  }
}
2 Likes