Skip to content

Instantly share code, notes, and snippets.

@pksokolowski
Created December 26, 2021 10:57
Show Gist options
  • Save pksokolowski/35f7acb63c2ed06f3ea6ba19324a8b09 to your computer and use it in GitHub Desktop.
Save pksokolowski/35f7acb63c2ed06f3ea6ba19324a8b09 to your computer and use it in GitHub Desktop.
Colorful print and println for Kotlin for terminals with TrueColor support.
private const val reset = "\u001b[0m"
fun printc(content: String, r: Int, g: Int, b: Int) = print("\u001b[38;2;$r;$g;${b}m" + content + reset)
fun printlnc(content: String, r: Int, g: Int, b: Int) = println("\u001b[38;2;$r;$g;${b}m" + content + reset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment