Skip to content

Instantly share code, notes, and snippets.

@tralston
Created March 21, 2015 17:22
Show Gist options
  • Save tralston/a76a720985a62af388f7 to your computer and use it in GitHub Desktop.
Save tralston/a76a720985a62af388f7 to your computer and use it in GitHub Desktop.
Add color to Gradle script
import org.gradle.logging.StyledTextOutput;
import org.gradle.logging.StyledTextOutputFactory;
import static org.gradle.logging.StyledTextOutput.Style;
StyledTextOutput o = services.get(StyledTextOutputFactory).create("test string")
task taskname << {
o.withStyle(Style.Description).append("Hello world!")
// Style.?? Can be normal, header, userinput, identifier, description, progressstatus, failure, info, or error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment