Created
November 2, 2020 09:22
-
-
Save dmytrokosiachenko/584542ad5937821f8e97c9f1966c4e48 to your computer and use it in GitHub Desktop.
Add color to jenkins output
This file contains 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
/* | |
+~~~~~~+~~~~~~+~~~~~~~~~~~+ | |
| 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 | | |
+~~~~~~+~~~~~~+~~~~~~~~~~~+ | |
*/ | |
private String addColours(int foreground, int background, String text) { | |
ANSI_RESET = "${(char) 27}[0m" | |
return "${(char) 27}[$foreground;$background" + "m" + text + ANSI_RESET | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment