AnsiEscape

interface AnsiEscape

Supports generating AnsiEscape escape codes. This allows to change the color and attributes of the text.

For example:

println(AnsiEscape { ("hello".red + " world".blue).bold })

Inheritors

Types

Link copied to clipboard

Available Ansi Colors: BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE

Link copied to clipboard

Properties

Link copied to clipboard

Shortcut for this.bgColor(Color.BLACK)

Link copied to clipboard
open val String.bgBlue: String

Shortcut for this.bgColor(Color.BLUE)

Link copied to clipboard
open val String.bgCyan: String

Shortcut for this.bgColor(Color.CYAN)

Link copied to clipboard

Shortcut for this.bgColor(Color.GREEN)

Link copied to clipboard

Shortcut for this.bgColor(Color.PURPLE)

Link copied to clipboard
open val String.bgRed: String

Shortcut for this.bgColor(Color.RED)

Link copied to clipboard

Shortcut for this.bgColor(Color.WHITE)

Link copied to clipboard

Shortcut for this.bgColor(Color.YELLOW)

Link copied to clipboard
open val String.black: String

Shortcut for this.color(Color.BLACK)

Link copied to clipboard
open val String.blue: String

Shortcut for this.color(Color.BLUE)

Link copied to clipboard
open val String.bold: String

Makes this String to be bold

Link copied to clipboard

Makes this String to be reversed/highlighted (background/color swapped)

Link copied to clipboard
open val String.cyan: String

Shortcut for this.color(Color.CYAN)

Link copied to clipboard
open val String.green: String

Shortcut for this.color(Color.GREEN)

Link copied to clipboard
open val String.purple: String

Shortcut for this.color(Color.PURPLE)

Link copied to clipboard
open val String.red: String

Shortcut for this.color(Color.RED)

Link copied to clipboard

Makes this String to be underlined

Link copied to clipboard
open val String.white: String

Shortcut for this.color(Color.WHITE)

Link copied to clipboard
open val String.yellow: String

Shortcut for this.color(Color.YELLOW)

Functions

Link copied to clipboard
open fun String.ansiEscape(code: Int, extra: String? = null, char: Char = 'm'): String

Sets a raw ansi escape sequence for this String

Link copied to clipboard
open fun StringBuilder.appendAnsiScape(code: Int, extra: String? = null, char: Char = 'm'): StringBuilder
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun String.bgColor(color: AnsiEscape.Color, bright: Boolean = false): String

Makes this string to be in background color and bright

Link copied to clipboard
open fun String.bgColor256(index: Int): String

Makes this string to be in background color index

Link copied to clipboard
open fun String.color(color: AnsiEscape.Color, bright: Boolean = false): String

Makes this string to be in foreground color and bright

Link copied to clipboard
open fun String.color256(index: Int): String

Makes this string to be in foreground color index