Disable color by default if formatting is disabled

If a user runs with -Dsbt.log.format=false or -Dsbt.log.noformat=true,
we should disable color by default. Running with -Dsbt.color=true should
make this possible.
This commit is contained in:
Ethan Atkins 2020-11-02 11:04:35 -08:00
parent 8c3f2a50f7
commit 1d3af543f7
1 changed files with 1 additions and 1 deletions

View File

@ -317,7 +317,7 @@ object Terminal {
props
.map(_.color)
.orElse(isColorEnabledProp)
.getOrElse((hasConsole && !isDumbTerminal && logFormatEnabled.getOrElse(true)) || isCI)
.getOrElse(logFormatEnabled.getOrElse(true) && ((hasConsole && !isDumbTerminal) || isCI))
}
private[this] lazy val isColorEnabledProp: Option[Boolean] =
sys.props.get("sbt.color").orElse(sys.props.get("sbt.colour")).flatMap(parseLogOption)