Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server
- enum class Color(val fg: String, val bg: String) {
- BLACK("30", "40"),
- RED("31", "41"),
- GREEN("32", "42"),
- YELLOW("33", "43"),
- BLUE("34", "44"),
- MAGENTA("35", "45"),
- CYAN("36", "46"),
- WHITE("37", "47")
- }
- private fun String.color(color: Color): String {
- return "\u001B[${color.fg}m${this}\u001B[39m"
- }
- fun String.red(): String {
- return color(Color.RED)
- }
- fun String.black(): String {
- return color(Color.BLACK)
- }
- fun String.green(): String {
- return color(Color.GREEN)
- }
- fun String.yellow(): String {
- return color(Color.YELLOW)
- }
- fun String.blue(): String {
- return color(Color.BLUE)
- }
- fun String.magenta(): String {
- return color(Color.MAGENTA)
- }
- fun String.white(): String {
- return color(Color.WHITE)
- }
Add Comment
Please, Sign In to add comment