Created
June 13, 2018 14:21
-
-
Save crevier/f2529b8b474ecddeb606770d148e761f to your computer and use it in GitHub Desktop.
How to print color in console in groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fg = 30 | |
def bg = 46 | |
def style = "${(char)27}[$fg;$bg"+"m" | |
println(style+"HELLO") | |
/* | |
+~~~~~~+~~~~~~+~~~~~~~~~~~+ | |
| fg | bg | color | | |
+~~~~~~+~~~~~~+~~~~~~~~~~~+ | |
| 30 | 40 | black | | |
| 31 | 41 | red | | |
| 32 | 42 | green | | |
| 33 | 43 | yellow | | |
| 34 | 44 | blue | | |
| 35 | 45 | magenta | | |
| 36 | 46 | cyan | | |
| 37 | 47 | white | | |
| 39 | 49 | default | | |
+~~~~~~+~~~~~~+~~~~~~~~~~~+ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment