dynamic color Groovy output

sidhant tiwari September 17, 2018

I have a small script to print coloured groovy output to print RED & GREEN based of some condition, i am taking my output of groovy script as xhtml and its throwing the below exception.   Same works fine on console. But does not print the output on page. Can any 1 help ?

 

Groovy Script

String LIGHT_RED       = "\u001B[1;33m"
String LIGHT_GREEN     = "\u001B[1;32m"

static String color(String text, String ansiValue) {
    ansiValue + text
}


println color("LIGHT_GREEN1111", LIGHT_RED)
println color("LIGHT_RED", LIGHT_GREEN)

 

Exception:

Error: [com.ctc.wstx.exc.WstxLazyException] Illegal character ((CTRL-CHAR, code 27)) at [row,col {unknown-source}]: [1,321]

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events