Merge pull request #6017 from eatkins/log-format-color

Set color by default only if log format enabled
This commit is contained in:
eugene yokota 2020-10-24 17:20:04 -04:00 committed by GitHub
commit 078b9c69c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -314,7 +314,10 @@ object Terminal {
private[this] def useColorDefault: Boolean = {
// This approximates that both stdin and stdio are connected,
// so by default color will be turned off for pipes and redirects.
props.map(_.color).orElse(isColorEnabledProp).getOrElse((hasConsole && !isDumbTerminal) || isCI)
props
.map(_.color)
.orElse(isColorEnabledProp)
.getOrElse((hasConsole && !isDumbTerminal && logFormatEnabled.getOrElse(true)) || isCI)
}
private[this] lazy val isColorEnabledProp: Option[Boolean] =
sys.props.get("sbt.color").orElse(sys.props.get("sbt.colour")).flatMap(parseLogOption)