AnsiColor

trait AnsiColor

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
Source
AnsiColor.scala
class Object
trait Matchable
class Any
object Console
object AnsiColor

ANSI Style and Control Codes

final val BOLD: "\033[1m"

ANSI bold

ANSI bold

Source
AnsiColor.scala
final val INVISIBLE: "\033[8m"

ANSI invisible

ANSI invisible

Source
AnsiColor.scala
final val RESET: "\033[0m"

Reset ANSI styles

Reset ANSI styles

Source
AnsiColor.scala
final val REVERSED: "\033[7m"

ANSI reversed

ANSI reversed

Source
AnsiColor.scala
final val UNDERLINED: "\033[4m"

ANSI underlines

ANSI underlines

Source
AnsiColor.scala

ANSI Black

 

final val BLACK: "\033[30m"

Foreground color for ANSI black

Foreground color for ANSI black

Source
AnsiColor.scala
final val BLACK_B: "\033[40m"

Background color for ANSI black

Background color for ANSI black

Source
AnsiColor.scala

ANSI Red

 

final val RED: "\033[31m"

Foreground color for ANSI red

Foreground color for ANSI red

Source
AnsiColor.scala
final val RED_B: "\033[41m"

Background color for ANSI red

Background color for ANSI red

Source
AnsiColor.scala

ANSI Green

 

final val GREEN: "\033[32m"

Foreground color for ANSI green

Foreground color for ANSI green

Source
AnsiColor.scala
final val GREEN_B: "\033[42m"

Background color for ANSI green

Background color for ANSI green

Source
AnsiColor.scala

ANSI Yellow

 

final val YELLOW: "\033[33m"

Foreground color for ANSI yellow

Foreground color for ANSI yellow

Source
AnsiColor.scala
final val YELLOW_B: "\033[43m"

Background color for ANSI yellow

Background color for ANSI yellow

Source
AnsiColor.scala

ANSI Blue

 

final val BLUE: "\033[34m"

Foreground color for ANSI blue

Foreground color for ANSI blue

Source
AnsiColor.scala
final val BLUE_B: "\033[44m"

Background color for ANSI blue

Background color for ANSI blue

Source
AnsiColor.scala

ANSI Magenta

 

final val MAGENTA: "\033[35m"

Foreground color for ANSI magenta

Foreground color for ANSI magenta

Source
AnsiColor.scala
final val MAGENTA_B: "\033[45m"

Background color for ANSI magenta

Background color for ANSI magenta

Source
AnsiColor.scala

ANSI Cyan

 

final val CYAN: "\033[36m"

Foreground color for ANSI cyan

Foreground color for ANSI cyan

Source
AnsiColor.scala
final val CYAN_B: "\033[46m"

Background color for ANSI cyan

Background color for ANSI cyan

Source
AnsiColor.scala

ANSI White

 

final val WHITE: "\033[37m"

Foreground color for ANSI white

Foreground color for ANSI white

Source
AnsiColor.scala
final val WHITE_B: "\033[47m"

Background color for ANSI white

Background color for ANSI white

Source
AnsiColor.scala