1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-05-06 20:29:52 -07:00

Experimenting with colors.

This commit is contained in:
Cedric Beust 2015-12-12 10:22:33 -08:00
parent c9500e023a
commit b895d4c8f2
4 changed files with 20 additions and 3 deletions

View file

@ -73,6 +73,23 @@ class AsciiArt {
val spaces = diff / 2 + 1
return fill(spaces) + s + fill(spaces + if (diff % 2 == 1) 1 else 0)
}
const val RESET = "\u001B[0m"
const val BLACK = "\u001B[30m"
const val RED = "\u001B[31m"
const val GREEN = "\u001B[32m"
const val YELLOW = "\u001B[33m";
const val BLUE = "\u001B[34m"
const val PURPLE = "\u001B[35m"
const val CYAN = "\u001B[36m"
const val WHITE = "\u001B[37m"
private fun wrap(s: String, color: String) = color + s + RESET
private fun red(s: String) = wrap(s, RED)
private fun yellow(s: String) = wrap(s, YELLOW)
fun taskColor(s: String) = yellow(s)
fun errorColor(s: String) = red(s)
}
}