AnsiColor

trait AnsiColor

ANSI escape codes providing control over text formatting and color on supporting text terminals.

ANSI escape codes providing control over text formatting and color on supporting text terminals.

ANSI Style and Control Codes

This group of escape codes provides control over text styling. For example, to turn on reverse video with bold and then turn off all styling embed these codes,

import io.AnsiColor._

object ColorDemo extends App {

 println(s"${REVERSED}${BOLD}Hello 1979!${RESET}")
}

Foreground and Background Colors

Embedding ANSI color codes in text output will control the text foreground and background colors.

ForegroundBackground
BLACK BLACK_B
RED RED_B
GREEN GREEN_B
YELLOW YELLOW_B
BLUE BLUE_B
MAGENTAMAGENTA_B
CYAN CYAN_B
WHITE WHITE_B

Companion
object
class Object
trait Matchable
class Any
object Console
object AnsiColor

ANSI Style and Control Codes

final val RESET: "\033[0m"

Reset ANSI styles

Reset ANSI styles

final val BOLD: "\033[1m"

ANSI bold

ANSI bold

final val UNDERLINED: "\033[4m"

ANSI underlines

ANSI underlines

final val REVERSED: "\033[7m"

ANSI reversed

ANSI reversed

final val INVISIBLE: "\033[8m"

ANSI invisible

ANSI invisible

ANSI Black

 

final val BLACK: "\033[30m"

Foreground color for ANSI black

Foreground color for ANSI black

final val BLACK_B: "\033[40m"

Background color for ANSI black

Background color for ANSI black

ANSI Red

 

final val RED: "\033[31m"

Foreground color for ANSI red

Foreground color for ANSI red

final val RED_B: "\033[41m"

Background color for ANSI red

Background color for ANSI red

ANSI Green

 

final val GREEN: "\033[32m"

Foreground color for ANSI green

Foreground color for ANSI green

final val GREEN_B: "\033[42m"

Background color for ANSI green

Background color for ANSI green

ANSI Yellow

 

final val YELLOW: "\033[33m"

Foreground color for ANSI yellow

Foreground color for ANSI yellow

final val YELLOW_B: "\033[43m"

Background color for ANSI yellow

Background color for ANSI yellow

ANSI Blue

 

final val BLUE: "\033[34m"

Foreground color for ANSI blue

Foreground color for ANSI blue

final val BLUE_B: "\033[44m"

Background color for ANSI blue

Background color for ANSI blue

ANSI Magenta

 

final val MAGENTA: "\033[35m"

Foreground color for ANSI magenta

Foreground color for ANSI magenta

final val MAGENTA_B: "\033[45m"

Background color for ANSI magenta

Background color for ANSI magenta

ANSI Cyan

 

final val CYAN: "\033[36m"

Foreground color for ANSI cyan

Foreground color for ANSI cyan

final val CYAN_B: "\033[46m"

Background color for ANSI cyan

Background color for ANSI cyan

ANSI White

 

final val WHITE: "\033[37m"

Foreground color for ANSI white

Foreground color for ANSI white

final val WHITE_B: "\033[47m"

Background color for ANSI white

Background color for ANSI white