Closed dkim19375 closed 1 year ago
By default, Mordant disables colors and animations when stdout is redirected so that it doesn't write ANSI codes to files. Since Gradle captures the output, it causes colors to be disabled.
If you want, you can force colors with Terminal(AnsiLevel.TRUECOLOR, interactive=true)
.
What I do is avoid the run
task, and instead use installDist
then run the binary directly. Here's an example of that
Cross-posting from here, I'm now solving this on a Gradle task level:
tasks.named<JavaExec>("run") {
System.getenv("TERM")?.also {
val mode = it.substringAfter('-', "16color")
environment("FORCE_COLOR" to mode)
}
System.getenv("COLORTERM")?.also {
environment("FORCE_COLOR" to it)
}
}
Regular ANSI color codes work fine, but not ones from Mordant:
gradle run
output:However,
java -jar BuiltJar.jar
works fineI also have tried to put
org.gradle.console=rich
in mygradle.properties
, but it doesn't seem to do anything