Skip to content

david-w-millar/gcolors

Repository files navigation

gcolors

Build Status

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.

Colors in action

Installation

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.
Gradle and Grails
  repositories {
    // ...
    maven { url  "http://dl.bintray.com/david-w-millar/maven" }
  }
  dependencies {
    // ...
    compile 'org.millarts:gcolors:0.5.2'
  }
Groovy Grape
@Grapes(
  @Grab(group='org.millarts', module='gcolors', version='0.5.2')
)
Maven
<dependency>
  <groupId>org.millarts</groupId>
  <artifactId>gcolors</artifactId>
  <version>0.5.2</version>
</dependency>

Usage

Example Usage
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.

Color and Style Support

Colors
  • black

  • red

  • green

  • yellow

  • blue

  • magenta

  • cyan

  • white

  • gray

  • grey

Background Colors
  • bgBlack

  • bgRed

  • bgGreen

  • bgYellow

  • bgBlue

  • bgMagenta

  • bgCyan

  • bgWhite

Styles
  • bold

  • dim

  • italic

  • underline

  • inverse

  • hidden

  • strikethrough

License

This project is licensed under the terms of the Apache License, Version 2.0.

© 2017 David W Millar

About

Groovy extension module to add ansi color and styles to strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages