Lightweight groovy extension module that provides ansi colors and styles to strings in supported terminals.
For more rigorous terminal acrobatics, checkout the awesome jansi project.
Include this in your classpath. Groovy does the rest.
Checkout [this bintray repo](https://bintray.com/david-w-millar/maven/gcolors/) for full details regarding how to use this.
Note
|
Requires groovy 2.0 or later. |
repositories {
// ...
maven { url "http://dl.bintray.com/david-w-millar/maven" }
}
dependencies {
// ...
compile 'org.millarts:gcolors:0.5.2'
}
@Grapes(
@Grab(group='org.millarts', module='gcolors', version='0.5.2')
)
<dependency>
<groupId>org.millarts</groupId>
<artifactId>gcolors</artifactId>
<version>0.5.2</version>
</dependency>
println "red".red()
println 'blue and underlined'.blue().underline()
println "I'm all kinds of blue and bold".cyan().bgBlue().bold()
println "I'm the inverse of the line above".cyan().bgBlue().bold().inverse()
This module attempts to determine if a terminal is capable of color. If not, it will not add any ansi escape characters to the string.
-
black
-
red
-
green
-
yellow
-
blue
-
magenta
-
cyan
-
white
-
gray
-
grey
-
bgBlack
-
bgRed
-
bgGreen
-
bgYellow
-
bgBlue
-
bgMagenta
-
bgCyan
-
bgWhite
-
bold
-
dim
-
italic
-
underline
-
inverse
-
hidden
-
strikethrough
This project is licensed under the terms of the Apache License, Version 2.0.
© 2017 David W Millar