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.type
object AnsiColor.type

ANSI Style and Control Codes

final val BOLD: "\u001b[1m"

ANSI bold

ANSI bold

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

ANSI invisible

ANSI invisible

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

Reset ANSI styles

Reset ANSI styles

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

ANSI reversed

ANSI reversed

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

ANSI underlines

ANSI underlines

Source:
AnsiColor.scala

ANSI Black

 

final val BLACK: "\u001b[30m"

Foreground color for ANSI black

Foreground color for ANSI black

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

Background color for ANSI black

Background color for ANSI black

Source:
AnsiColor.scala

ANSI Red

 

final val RED: "\u001b[31m"

Foreground color for ANSI red

Foreground color for ANSI red

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

Background color for ANSI red

Background color for ANSI red

Source:
AnsiColor.scala

ANSI Green

 

final val GREEN: "\u001b[32m"

Foreground color for ANSI green

Foreground color for ANSI green

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

Background color for ANSI green

Background color for ANSI green

Source:
AnsiColor.scala

ANSI Yellow

 

final val YELLOW: "\u001b[33m"

Foreground color for ANSI yellow

Foreground color for ANSI yellow

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

Background color for ANSI yellow

Background color for ANSI yellow

Source:
AnsiColor.scala

ANSI Blue

 

final val BLUE: "\u001b[34m"

Foreground color for ANSI blue

Foreground color for ANSI blue

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

Background color for ANSI blue

Background color for ANSI blue

Source:
AnsiColor.scala

ANSI Magenta

 

final val MAGENTA: "\u001b[35m"

Foreground color for ANSI magenta

Foreground color for ANSI magenta

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

Background color for ANSI magenta

Background color for ANSI magenta

Source:
AnsiColor.scala

ANSI Cyan

 

final val CYAN: "\u001b[36m"

Foreground color for ANSI cyan

Foreground color for ANSI cyan

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

Background color for ANSI cyan

Background color for ANSI cyan

Source:
AnsiColor.scala

ANSI White

 

final val WHITE: "\u001b[37m"

Foreground color for ANSI white

Foreground color for ANSI white

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

Background color for ANSI white

Background color for ANSI white

Source:
AnsiColor.scala