summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-17 19:16:38 -0700
committerPaul Phillips <paulp@improving.org>2012-03-18 10:36:55 -0700
commit438ae4766ae5245884a004acbf465125c97813f5 (patch)
treef75fb994a944b7c6796f65f1e07522c2a0837dd5
parentd267988ddbf03c71fa1ef2fa51f2d218793632ed (diff)
downloadscala-438ae4766ae5245884a004acbf465125c97813f5.tar.gz
scala-438ae4766ae5245884a004acbf465125c97813f5.tar.bz2
scala-438ae4766ae5245884a004acbf465125c97813f5.zip
Library for ansi color management.
Having now experienced the unbelievable difference it makes to have one's voluminous debugging output effectively color-coded, I had to librarize the ansi codes in order to use them. This could all go in the standard library, or as soon as I can easily make use of compiler dependencies, a separate library altogether. For now it hides away in scala.tools.util.color.
-rw-r--r--src/compiler/scala/tools/util/color/Ansi.scala58
-rw-r--r--src/compiler/scala/tools/util/color/AnsiAtom.scala51
-rw-r--r--src/compiler/scala/tools/util/color/CString.scala28
-rw-r--r--src/compiler/scala/tools/util/color/ColorNames.scala391
-rw-r--r--src/compiler/scala/tools/util/color/package.scala21
-rw-r--r--test/files/run/color.check693
-rw-r--r--test/files/run/color.scala33
7 files changed, 1275 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/util/color/Ansi.scala b/src/compiler/scala/tools/util/color/Ansi.scala
new file mode 100644
index 0000000000..1ed43579bb
--- /dev/null
+++ b/src/compiler/scala/tools/util/color/Ansi.scala
@@ -0,0 +1,58 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2012 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.util
+package color
+
+import collection.mutable
+
+object Ansi {
+ final val ESC = '\u001b' // <esc>
+ final val LBR = '\u005b' // [
+ final val CSI = new String(Array(ESC, LBR)) // control sequence introducer
+ final val CSI_FINAL = "m" // control sequence final byte
+
+ def colors = List(Black, Red, Green, Yellow, Blue, Magenta, Cyan, White)
+ def effects = List(Reset, Bright, Faint, Italic, Underline, Blink, Inverse, Hidden, Strikethrough)
+
+ // No, that's not the finale of "CSI: Crime Scene Investigation."
+
+ def colorizerFor(codes: Seq[Int]): String => String =
+ s => ansiCodeToString(codes) + s + ansiCodeToString(0)
+
+ def ansiCodeToString(code: Int): String = CSI + code + CSI_FINAL
+ def ansiCodeToString(codes: Seq[Int]): String = codes.mkString(CSI, ";", CSI_FINAL)
+}
+
+/** An ansi control sequence. The colorize function prepends
+ * the control sequence to the given String and appends a
+ * reset sequence.
+ */
+class Ansi(atoms0: List[AnsiAtom]) {
+ val atoms = atoms0 sortBy (x => (!x.isAttr, x.isInstanceOf[AnsiBackground]))
+ val colorize = Ansi colorizerFor codes
+
+ def codes = atoms map (_.code)
+ def /(that: AnsiAtom) = new Ansi(atoms :+ that)
+ // This looks redundant with / , but isn't - it is a way
+ // to ensure that the argument will be a background color,
+ // even if a foreground color is passed as an argument
+ // (as it will be implicitly converted.)
+ def on(that: AnsiBackground) = this / that
+
+ // Convenience functions.
+ def reset = this / Reset
+ def bright = this / Bright
+ def faint = this / Faint
+ def italic = this / Italic
+ def underline = this / Underline
+ def blink = this / Blink
+ def inverse = this / Inverse
+ def hidden = this / Hidden
+ def strikethrough = this / Strikethrough
+
+ // adjectives first
+ override def toString = atoms mkString " "
+}
diff --git a/src/compiler/scala/tools/util/color/AnsiAtom.scala b/src/compiler/scala/tools/util/color/AnsiAtom.scala
new file mode 100644
index 0000000000..5d5490f6e9
--- /dev/null
+++ b/src/compiler/scala/tools/util/color/AnsiAtom.scala
@@ -0,0 +1,51 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2012 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.util
+package color
+
+case object Reset extends AnsiAttr(0)
+case object Bright extends AnsiAttr(1)
+case object Faint extends AnsiAttr(2)
+case object Italic extends AnsiAttr(3)
+case object Underline extends AnsiAttr(4)
+case object Blink extends AnsiAttr(5)
+case object Inverse extends AnsiAttr(7)
+case object Hidden extends AnsiAttr(8)
+case object Strikethrough extends AnsiAttr(9)
+
+case object Black extends AnsiForeground(30)
+case object Red extends AnsiForeground(31)
+case object Green extends AnsiForeground(32)
+case object Yellow extends AnsiForeground(33)
+case object Blue extends AnsiForeground(34)
+case object Magenta extends AnsiForeground(35)
+case object Cyan extends AnsiForeground(36)
+case object White extends AnsiForeground(37)
+case object Default extends AnsiForeground(39)
+
+/** One piece of an ansi control sequence. Either a color
+ * (foreground or background) or an attribute (e.g. bright, underline.)
+ * Control sequences are created from AnsiAtoms with the / operator.
+ */
+trait AnsiAtom {
+ def code: Int
+ def isAttr: Boolean
+}
+sealed abstract class AnsiAttr(val code: Int) extends AnsiAtom {
+ final def isAttr = true
+}
+sealed abstract class AnsiColor(val code: Int) extends AnsiAtom {
+ final def isAttr = false
+ def flip: AnsiColor
+}
+sealed abstract class AnsiForeground(code: Int) extends AnsiColor(code) {
+ require(30 <= code && code <= 39, code)
+ val flip: AnsiBackground = new AnsiBackground(this)
+}
+sealed class AnsiBackground(val flip: AnsiForeground) extends AnsiColor(flip.code + 10) {
+ require(40 <= code && code <= 49, code)
+ override def toString = "(on " + flip + " background)"
+}
diff --git a/src/compiler/scala/tools/util/color/CString.scala b/src/compiler/scala/tools/util/color/CString.scala
new file mode 100644
index 0000000000..d0785eaeff
--- /dev/null
+++ b/src/compiler/scala/tools/util/color/CString.scala
@@ -0,0 +1,28 @@
+package scala.tools.util
+package color
+
+/** A colorized String. It's difficult to achieve precise
+ * formatting and selective string colorization simultaneously,
+ * because all length-based calculations will break down in
+ * the face of the ansi controls. It doesn't do much yet, but
+ * this is here to eventually make that transparent.
+ */
+final class CString(val uncolorized: String, val colorized: String) {
+ def visibleLength = uncolorized.length
+ def colorizedLength = colorized.length
+ def show() = Console println colorized
+ def bytes() = colorized map (ch => ch.toByte)
+ def > = show()
+
+ def append(x: CString): CString = new CString(uncolorized + x.uncolorized, colorized + x.colorized)
+ def +(other: CString): CString = this append other
+ override def toString = colorized
+}
+
+class CStringOps(str: String) {
+ /** Enables for example
+ * println("foo" in Red)
+ * println("foo" in Magenta.bright)
+ */
+ def in(ansi: Ansi): CString = new CString(str, ansi colorize str)
+}
diff --git a/src/compiler/scala/tools/util/color/ColorNames.scala b/src/compiler/scala/tools/util/color/ColorNames.scala
new file mode 100644
index 0000000000..ff4b01a9df
--- /dev/null
+++ b/src/compiler/scala/tools/util/color/ColorNames.scala
@@ -0,0 +1,391 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2012 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.util.color
+
+/** Raw data adapted from perl's Term-ExtendedColor, which is published
+ * under perl's Artistic license: http://dev.perl.org/licenses/artistic.html
+ *
+ * These aren't actually in use yet.
+ */
+trait ColorNames {
+ type ColorType
+ def translateCode(ansiCode: String): ColorType
+
+ private implicit def liftAnsiCode(code: String): ColorType = translateCode(code)
+
+ // Possible alternative names or aliases, also from the perl:
+ //
+ // reset, clear, normal reset all attributes
+ // bold, bright bold or bright, depending on implementation
+ // faint decreased intensity (not widely supported)
+ // italic, cursive italic or cursive
+ // underline, underscore underline
+ // blink slow blink
+ // blink_ms rapid blink (only supported in MS DOS)
+ // reverse, inverse, negative reverse video
+ // conceal conceal, or hide (not widely supported)
+
+ // Brightest to darkest color
+ val red1: ColorType = "5;196"
+ val red2: ColorType = "5;160"
+ val red3: ColorType = "5;124"
+ val red4: ColorType = "5;088"
+ val red5: ColorType = "5;052"
+
+ val green1: ColorType = "5;156"
+ val green2: ColorType = "5;150"
+ val green3: ColorType = "5;120"
+ val green4: ColorType = "5;114"
+ val green5: ColorType = "5;084"
+ val green6: ColorType = "5;078"
+ val green7: ColorType = "5;155"
+ val green8: ColorType = "5;149"
+ val green9: ColorType = "5;119"
+ val green10: ColorType = "5;113"
+ val green11: ColorType = "5;083"
+ val green12: ColorType = "5;077"
+ val green13: ColorType = "5;047"
+ val green14: ColorType = "5;041"
+ val green15: ColorType = "5;118"
+ val green16: ColorType = "5;112"
+ val green17: ColorType = "5;082"
+ val green18: ColorType = "5;076"
+ val green19: ColorType = "5;046"
+ val green20: ColorType = "5;040"
+ val green21: ColorType = "5;034"
+ val green22: ColorType = "5;028"
+ val green23: ColorType = "5;022"
+ val green24: ColorType = "5;107"
+ val green25: ColorType = "5;071"
+ val green26: ColorType = "5;070"
+ val green27: ColorType = "5;064"
+ val green28: ColorType = "5;065"
+
+ val blue1: ColorType = "5;075"
+ val blue2: ColorType = "5;074"
+ val blue3: ColorType = "5;073"
+ val blue4: ColorType = "5;039"
+ val blue5: ColorType = "5;038"
+ val blue6: ColorType = "5;037"
+ val blue7: ColorType = "5;033"
+ val blue8: ColorType = "5;032"
+ val blue9: ColorType = "5;031"
+ val blue10: ColorType = "5;027"
+ val blue11: ColorType = "5;026"
+ val blue12: ColorType = "5;025"
+ val blue13: ColorType = "5;021"
+ val blue14: ColorType = "5;020"
+ val blue15: ColorType = "5;019"
+ val blue16: ColorType = "5;018"
+ val blue17: ColorType = "5;017"
+
+ val yellow1: ColorType = "5;228"
+ val yellow2: ColorType = "5;222"
+ val yellow3: ColorType = "5;192"
+ val yellow4: ColorType = "5;186"
+ val yellow5: ColorType = "5;227"
+ val yellow6: ColorType = "5;221"
+ val yellow7: ColorType = "5;191"
+ val yellow8: ColorType = "5;185"
+ val yellow9: ColorType = "5;226"
+ val yellow10: ColorType = "5;220"
+ val yellow11: ColorType = "5;190"
+ val yellow12: ColorType = "5;184"
+ val yellow13: ColorType = "5;214"
+ val yellow14: ColorType = "5;178"
+ val yellow15: ColorType = "5;208"
+ val yellow16: ColorType = "5;172"
+ val yellow17: ColorType = "5;202"
+ val yellow18: ColorType = "5;166"
+
+ val magenta1: ColorType = "5;219"
+ val magenta2: ColorType = "5;183"
+ val magenta3: ColorType = "5;218"
+ val magenta4: ColorType = "5;182"
+ val magenta5: ColorType = "5;217"
+ val magenta6: ColorType = "5;181"
+ val magenta7: ColorType = "5;213"
+ val magenta8: ColorType = "5;177"
+ val magenta9: ColorType = "5;212"
+ val magenta10: ColorType = "5;176"
+ val magenta11: ColorType = "5;211"
+ val magenta12: ColorType = "5;175"
+ val magenta13: ColorType = "5;207"
+ val magenta14: ColorType = "5;171"
+ val magenta15: ColorType = "5;205"
+ val magenta16: ColorType = "5;169"
+ val magenta17: ColorType = "5;201"
+ val magenta18: ColorType = "5;165"
+ val magenta19: ColorType = "5;200"
+ val magenta20: ColorType = "5;164"
+ val magenta21: ColorType = "5;199"
+ val magenta22: ColorType = "5;163"
+ val magenta23: ColorType = "5;198"
+ val magenta24: ColorType = "5;162"
+ val magenta25: ColorType = "5;197"
+ val magenta26: ColorType = "5;161"
+
+ val gray1: ColorType = "5;255"
+ val gray2: ColorType = "5;254"
+ val gray3: ColorType = "5;253"
+ val gray4: ColorType = "5;252"
+ val gray5: ColorType = "5;251"
+ val gray6: ColorType = "5;250"
+ val gray7: ColorType = "5;249"
+ val gray8: ColorType = "5;248"
+ val gray9: ColorType = "5;247"
+ val gray10: ColorType = "5;246"
+ val gray11: ColorType = "5;245"
+ val gray12: ColorType = "5;244"
+ val gray13: ColorType = "5;243"
+ val gray14: ColorType = "5;242"
+ val gray15: ColorType = "5;241"
+ val gray16: ColorType = "5;240"
+ val gray17: ColorType = "5;239"
+ val gray18: ColorType = "5;238"
+ val gray19: ColorType = "5;237"
+ val gray20: ColorType = "5;236"
+ val gray21: ColorType = "5;235"
+ val gray22: ColorType = "5;234"
+ val gray23: ColorType = "5;233"
+ val gray24: ColorType = "5;232"
+
+ val purple1: ColorType = "5;147"
+ val purple2: ColorType = "5;146"
+ val purple3: ColorType = "5;145"
+ val purple4: ColorType = "5;141"
+ val purple5: ColorType = "5;140"
+ val purple6: ColorType = "5;139"
+ val purple7: ColorType = "5;135"
+ val purple8: ColorType = "5;134"
+ val purple9: ColorType = "5;133"
+ val purple10: ColorType = "5;129"
+ val purple11: ColorType = "5;128"
+ val purple12: ColorType = "5;127"
+ val purple13: ColorType = "5;126"
+ val purple14: ColorType = "5;125"
+ val purple15: ColorType = "5;111"
+ val purple16: ColorType = "5;110"
+ val purple17: ColorType = "5;109"
+ val purple18: ColorType = "5;105"
+ val purple19: ColorType = "5;104"
+ val purple20: ColorType = "5;103"
+ val purple21: ColorType = "5;099"
+ val purple22: ColorType = "5;098"
+ val purple23: ColorType = "5;097"
+ val purple24: ColorType = "5;096"
+ val purple25: ColorType = "5;093"
+ val purple26: ColorType = "5;092"
+ val purple27: ColorType = "5;091"
+ val purple28: ColorType = "5;090"
+ val purple29: ColorType = "5;055"
+ val purple30: ColorType = "5;054"
+
+ val cyan1: ColorType = "5;159"
+ val cyan2: ColorType = "5;158"
+ val cyan3: ColorType = "5;157"
+ val cyan4: ColorType = "5;153"
+ val cyan5: ColorType = "5;152"
+ val cyan6: ColorType = "5;151"
+ val cyan7: ColorType = "5;123"
+ val cyan8: ColorType = "5;122"
+ val cyan9: ColorType = "5;121"
+ val cyan10: ColorType = "5;117"
+ val cyan11: ColorType = "5;116"
+ val cyan12: ColorType = "5;115"
+ val cyan13: ColorType = "5;087"
+ val cyan14: ColorType = "5;086"
+ val cyan15: ColorType = "5;085"
+ val cyan16: ColorType = "5;081"
+ val cyan17: ColorType = "5;080"
+ val cyan18: ColorType = "5;079"
+ val cyan19: ColorType = "5;051"
+ val cyan20: ColorType = "5;050"
+ val cyan21: ColorType = "5;049"
+ val cyan22: ColorType = "5;045"
+ val cyan23: ColorType = "5;044"
+ val cyan24: ColorType = "5;043"
+
+ val orange1: ColorType = "5;208"
+ val orange2: ColorType = "5;172"
+ val orange3: ColorType = "5;202"
+ val orange4: ColorType = "5;166"
+ val orange5: ColorType = "5;130"
+
+ // Approximations of X11 color mappings
+ // https://secure.wikimedia.org/wikipedia/en/wiki/X11%20colors
+
+ val aquamarine1: ColorType = "5;086"
+ val aquamarine3: ColorType = "5;079"
+ val blueviolet: ColorType = "5;057"
+ val cadetblue1: ColorType = "5;072"
+ val cadetblue2: ColorType = "5;073"
+ val chartreuse1: ColorType = "5;118"
+ val chartreuse2: ColorType = "5;082"
+ val chartreuse3: ColorType = "5;070"
+ val chartreuse4: ColorType = "5;064"
+ val cornflowerblue: ColorType = "5;069"
+ val cornsilk1: ColorType = "5;230"
+ val darkblue: ColorType = "5;018"
+ val darkcyan: ColorType = "5;036"
+ val darkgoldenrod: ColorType = "5;136"
+ val darkgreen: ColorType = "5;022"
+ val darkkhaki: ColorType = "5;143"
+ val darkmagenta1: ColorType = "5;090"
+ val darkmagenta2: ColorType = "5;091"
+ val darkolivegreen1: ColorType = "5;191"
+ val darkolivegreen2: ColorType = "5;155"
+ val darkolivegreen3: ColorType = "5;107"
+ val darkolivegreen4: ColorType = "5;113"
+ val darkolivegreen5: ColorType = "5;149"
+ val darkorange3: ColorType = "5;130"
+ val darkorange4: ColorType = "5;166"
+ val darkorange1: ColorType = "5;208"
+ val darkred1: ColorType = "5;052"
+ val darkred2: ColorType = "5;088"
+ val darkseagreen1: ColorType = "5;158"
+ val darkseagreen2: ColorType = "5;157"
+ val darkseagreen3: ColorType = "5;150"
+ val darkseagreen4: ColorType = "5;071"
+ val darkslategray1: ColorType = "5;123"
+ val darkslategray2: ColorType = "5;087"
+ val darkslategray3: ColorType = "5;116"
+ val darkturquoise: ColorType = "5;044"
+ val darkviolet: ColorType = "5;128"
+ val deeppink1: ColorType = "5;198"
+ val deeppink2: ColorType = "5;197"
+ val deeppink3: ColorType = "5;162"
+ val deeppink4: ColorType = "5;125"
+ val deepskyblue1: ColorType = "5;039"
+ val deepskyblue2: ColorType = "5;038"
+ val deepskyblue3: ColorType = "5;031"
+ val deepskyblue4: ColorType = "5;023"
+ val dodgerblue1: ColorType = "5;033"
+ val dodgerblue2: ColorType = "5;027"
+ val dodgerblue3: ColorType = "5;026"
+ val gold1: ColorType = "5;220"
+ val gold3: ColorType = "5;142"
+ val greenyellow: ColorType = "5;154"
+ val grey0: ColorType = "5;016"
+ val grey100: ColorType = "5;231"
+ val grey11: ColorType = "5;234"
+ val grey15: ColorType = "5;235"
+ val grey19: ColorType = "5;236"
+ val grey23: ColorType = "5;237"
+ val grey27: ColorType = "5;238"
+ val grey30: ColorType = "5;239"
+ val grey3: ColorType = "5;232"
+ val grey35: ColorType = "5;240"
+ val grey37: ColorType = "5;059"
+ val grey39: ColorType = "5;241"
+ val grey42: ColorType = "5;242"
+ val grey46: ColorType = "5;243"
+ val grey50: ColorType = "5;244"
+ val grey53: ColorType = "5;102"
+ val grey54: ColorType = "5;245"
+ val grey58: ColorType = "5;246"
+ val grey62: ColorType = "5;247"
+ val grey63: ColorType = "5;139"
+ val grey66: ColorType = "5;248"
+ val grey69: ColorType = "5;145"
+ val grey70: ColorType = "5;249"
+ val grey74: ColorType = "5;250"
+ val grey7: ColorType = "5;233"
+ val grey78: ColorType = "5;251"
+ val grey82: ColorType = "5;252"
+ val grey84: ColorType = "5;188"
+ val grey85: ColorType = "5;253"
+ val grey89: ColorType = "5;254"
+ val grey93: ColorType = "5;255"
+ val honeydew2: ColorType = "5;194"
+ val hotpink2: ColorType = "5;169"
+ val hotpink3: ColorType = "5;132"
+ val hotpink: ColorType = "5;205"
+ val indianred1: ColorType = "5;203"
+ val indianred: ColorType = "5;167"
+ val khaki1: ColorType = "5;228"
+ val khaki3: ColorType = "5;185"
+ val lightcoral: ColorType = "5;210"
+ val lightcyan1: ColorType = "5;195"
+ val lightcyan3: ColorType = "5;152"
+ val lightgoldenrod1: ColorType = "5;227"
+ val lightgoldenrod2: ColorType = "5;186"
+ val lightgoldenrod3: ColorType = "5;179"
+ val lightgreen: ColorType = "5;119"
+ val lightpink1: ColorType = "5;217"
+ val lightpink3: ColorType = "5;174"
+ val lightpink4: ColorType = "5;095"
+ val lightsalmon1: ColorType = "5;216"
+ val lightsalmon3: ColorType = "5;137"
+ val lightseagreen: ColorType = "5;037"
+ val lightskyblue1: ColorType = "5;153"
+ val lightskyblue3: ColorType = "5;109"
+ val lightslateblue: ColorType = "5;105"
+ val lightslategrey: ColorType = "5;103"
+ val lightsteelblue1: ColorType = "5;189"
+ val lightsteelblue3: ColorType = "5;146"
+ val lightsteelblue: ColorType = "5;147"
+ val lightyellow3: ColorType = "5;187"
+ val mediumorchid1: ColorType = "5;171"
+ val mediumorchid3: ColorType = "5;133"
+ val mediumorchid: ColorType = "5;134"
+ val mediumpurple1: ColorType = "5;141"
+ val mediumpurple2: ColorType = "5;135"
+ val mediumpurple3: ColorType = "5;097"
+ val mediumpurple4: ColorType = "5;060"
+ val mediumpurple: ColorType = "5;104"
+ val mediumspringgreen: ColorType = "5;049"
+ val mediumturquoise: ColorType = "5;080"
+ val mediumvioletred: ColorType = "5;126"
+ val mistyrose1: ColorType = "5;224"
+ val mistyrose3: ColorType = "5;181"
+ val navajowhite1: ColorType = "5;223"
+ val navajowhite3: ColorType = "5;144"
+ val navyblue: ColorType = "5;017"
+ val orangered1: ColorType = "5;202"
+ val orchid1: ColorType = "5;213"
+ val orchid2: ColorType = "5;212"
+ val orchid: ColorType = "5;170"
+ val palegreen1: ColorType = "5;121"
+ val palegreen3: ColorType = "5;077"
+ val paleturquoise1: ColorType = "5;159"
+ val paleturquoise4: ColorType = "5;066"
+ val palevioletred1: ColorType = "5;211"
+ val pink1: ColorType = "5;218"
+ val pink3: ColorType = "5;175"
+ val plum1: ColorType = "5;219"
+ val plum2: ColorType = "5;183"
+ val plum3: ColorType = "5;176"
+ val plum4: ColorType = "5;096"
+ val purple: ColorType = "5;129"
+ val rosybrown: ColorType = "5;138"
+ val royalblue1: ColorType = "5;063"
+ val salmon1: ColorType = "5;209"
+ val sandybrown: ColorType = "5;215"
+ val seagreen1: ColorType = "5;084"
+ val seagreen2: ColorType = "5;083"
+ val seagreen3: ColorType = "5;078"
+ val skyblue1: ColorType = "5;117"
+ val skyblue2: ColorType = "5;111"
+ val skyblue3: ColorType = "5;074"
+ val slateblue1: ColorType = "5;099"
+ val slateblue3: ColorType = "5;061"
+ val springgreen1: ColorType = "5;048"
+ val springgreen2: ColorType = "5;042"
+ val springgreen3: ColorType = "5;035"
+ val springgreen4: ColorType = "5;029"
+ val steelblue1: ColorType = "5;075"
+ val steelblue3: ColorType = "5;068"
+ val steelblue: ColorType = "5;067"
+ val tan: ColorType = "5;180"
+ val thistle1: ColorType = "5;225"
+ val thistle3: ColorType = "5;182"
+ val turquoise2: ColorType = "5;045"
+ val turquoise4: ColorType = "5;030"
+ val violet: ColorType = "5;177"
+ val wheat1: ColorType = "5;229"
+ val wheat4: ColorType = "5;101"
+}
diff --git a/src/compiler/scala/tools/util/color/package.scala b/src/compiler/scala/tools/util/color/package.scala
new file mode 100644
index 0000000000..7c7c7dab74
--- /dev/null
+++ b/src/compiler/scala/tools/util/color/package.scala
@@ -0,0 +1,21 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2012 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.util
+
+/**
+ * Wrappers around ansi colors.
+ *
+ * @author Paul Phillips
+ * @version 2.10
+ */
+package object color {
+ implicit def implicitLiftAnsiAtom(c: AnsiAtom): Ansi = new Ansi(List(c))
+ implicit def implicitColorToBackground(c: AnsiColor): AnsiBackground = c match {
+ case x: AnsiBackground => x
+ case x: AnsiForeground => x.flip
+ }
+ implicit def implicitCStringOps(str: String): CStringOps = new CStringOps(str)
+}
diff --git a/test/files/run/color.check b/test/files/run/color.check
new file mode 100644
index 0000000000..598cc145f0
--- /dev/null
+++ b/test/files/run/color.check
@@ -0,0 +1,693 @@
+
+1 color
+the quick brown fox Black
+the quick brown fox Red
+the quick brown fox Green
+the quick brown fox Yellow
+the quick brown fox Blue
+the quick brown fox Magenta
+the quick brown fox Cyan
+the quick brown fox White
+
+1 effect
+the quick brown fox Reset
+the quick brown fox Bright
+the quick brown fox Faint
+the quick brown fox Italic
+the quick brown fox Underline
+the quick brown fox Blink
+the quick brown fox Inverse
+the quick brown fox Hidden
+the quick brown fox Strikethrough
+
+1 color 1 effect
+the quick brown fox Bright Black
+the quick brown fox Underline Black
+the quick brown fox Inverse Black
+the quick brown fox Bright Red
+the quick brown fox Underline Red
+the quick brown fox Inverse Red
+the quick brown fox Bright Green
+the quick brown fox Underline Green
+the quick brown fox Inverse Green
+the quick brown fox Bright Yellow
+the quick brown fox Underline Yellow
+the quick brown fox Inverse Yellow
+the quick brown fox Bright Blue
+the quick brown fox Underline Blue
+the quick brown fox Inverse Blue
+the quick brown fox Bright Magenta
+the quick brown fox Underline Magenta
+the quick brown fox Inverse Magenta
+the quick brown fox Bright Cyan
+the quick brown fox Underline Cyan
+the quick brown fox Inverse Cyan
+the quick brown fox Bright White
+the quick brown fox Underline White
+the quick brown fox Inverse White
+
+2 colors 0 effects
+the quick brown fox Black (on Black background)
+the quick brown fox Red (on Black background)
+the quick brown fox Green (on Black background)
+the quick brown fox Yellow (on Black background)
+the quick brown fox Blue (on Black background)
+the quick brown fox Magenta (on Black background)
+the quick brown fox Cyan (on Black background)
+the quick brown fox White (on Black background)
+the quick brown fox Black (on Red background)
+the quick brown fox Red (on Red background)
+the quick brown fox Green (on Red background)
+the quick brown fox Yellow (on Red background)
+the quick brown fox Blue (on Red background)
+the quick brown fox Magenta (on Red background)
+the quick brown fox Cyan (on Red background)
+the quick brown fox White (on Red background)
+the quick brown fox Black (on Green background)
+the quick brown fox Red (on Green background)
+the quick brown fox Green (on Green background)
+the quick brown fox Yellow (on Green background)
+the quick brown fox Blue (on Green background)
+the quick brown fox Magenta (on Green background)
+the quick brown fox Cyan (on Green background)
+the quick brown fox White (on Green background)
+the quick brown fox Black (on Yellow background)
+the quick brown fox Red (on Yellow background)
+the quick brown fox Green (on Yellow background)
+the quick brown fox Yellow (on Yellow background)
+the quick brown fox Blue (on Yellow background)
+the quick brown fox Magenta (on Yellow background)
+the quick brown fox Cyan (on Yellow background)
+the quick brown fox White (on Yellow background)
+the quick brown fox Black (on Blue background)
+the quick brown fox Red (on Blue background)
+the quick brown fox Green (on Blue background)
+the quick brown fox Yellow (on Blue background)
+the quick brown fox Blue (on Blue background)
+the quick brown fox Magenta (on Blue background)
+the quick brown fox Cyan (on Blue background)
+the quick brown fox White (on Blue background)
+the quick brown fox Black (on Magenta background)
+the quick brown fox Red (on Magenta background)
+the quick brown fox Green (on Magenta background)
+the quick brown fox Yellow (on Magenta background)
+the quick brown fox Blue (on Magenta background)
+the quick brown fox Magenta (on Magenta background)
+the quick brown fox Cyan (on Magenta background)
+the quick brown fox White (on Magenta background)
+the quick brown fox Black (on Cyan background)
+the quick brown fox Red (on Cyan background)
+the quick brown fox Green (on Cyan background)
+the quick brown fox Yellow (on Cyan background)
+the quick brown fox Blue (on Cyan background)
+the quick brown fox Magenta (on Cyan background)
+the quick brown fox Cyan (on Cyan background)
+the quick brown fox White (on Cyan background)
+the quick brown fox Black (on White background)
+the quick brown fox Red (on White background)
+the quick brown fox Green (on White background)
+the quick brown fox Yellow (on White background)
+the quick brown fox Blue (on White background)
+the quick brown fox Magenta (on White background)
+the quick brown fox Cyan (on White background)
+the quick brown fox White (on White background)
+
+2 colors 1 effect
+the quick brown fox Bright Black (on Black background)
+the quick brown fox Underline Black (on Black background)
+the quick brown fox Inverse Black (on Black background)
+the quick brown fox Bright Red (on Black background)
+the quick brown fox Underline Red (on Black background)
+the quick brown fox Inverse Red (on Black background)
+the quick brown fox Bright Green (on Black background)
+the quick brown fox Underline Green (on Black background)
+the quick brown fox Inverse Green (on Black background)
+the quick brown fox Bright Yellow (on Black background)
+the quick brown fox Underline Yellow (on Black background)
+the quick brown fox Inverse Yellow (on Black background)
+the quick brown fox Bright Blue (on Black background)
+the quick brown fox Underline Blue (on Black background)
+the quick brown fox Inverse Blue (on Black background)
+the quick brown fox Bright Magenta (on Black background)
+the quick brown fox Underline Magenta (on Black background)
+the quick brown fox Inverse Magenta (on Black background)
+the quick brown fox Bright Cyan (on Black background)
+the quick brown fox Underline Cyan (on Black background)
+the quick brown fox Inverse Cyan (on Black background)
+the quick brown fox Bright White (on Black background)
+the quick brown fox Underline White (on Black background)
+the quick brown fox Inverse White (on Black background)
+the quick brown fox Bright Black (on Red background)
+the quick brown fox Underline Black (on Red background)
+the quick brown fox Inverse Black (on Red background)
+the quick brown fox Bright Red (on Red background)
+the quick brown fox Underline Red (on Red background)
+the quick brown fox Inverse Red (on Red background)
+the quick brown fox Bright Green (on Red background)
+the quick brown fox Underline Green (on Red background)
+the quick brown fox Inverse Green (on Red background)
+the quick brown fox Bright Yellow (on Red background)
+the quick brown fox Underline Yellow (on Red background)
+the quick brown fox Inverse Yellow (on Red background)
+the quick brown fox Bright Blue (on Red background)
+the quick brown fox Underline Blue (on Red background)
+the quick brown fox Inverse Blue (on Red background)
+the quick brown fox Bright Magenta (on Red background)
+the quick brown fox Underline Magenta (on Red background)
+the quick brown fox Inverse Magenta (on Red background)
+the quick brown fox Bright Cyan (on Red background)
+the quick brown fox Underline Cyan (on Red background)
+the quick brown fox Inverse Cyan (on Red background)
+the quick brown fox Bright White (on Red background)
+the quick brown fox Underline White (on Red background)
+the quick brown fox Inverse White (on Red background)
+the quick brown fox Bright Black (on Green background)
+the quick brown fox Underline Black (on Green background)
+the quick brown fox Inverse Black (on Green background)
+the quick brown fox Bright Red (on Green background)
+the quick brown fox Underline Red (on Green background)
+the quick brown fox Inverse Red (on Green background)
+the quick brown fox Bright Green (on Green background)
+the quick brown fox Underline Green (on Green background)
+the quick brown fox Inverse Green (on Green background)
+the quick brown fox Bright Yellow (on Green background)
+the quick brown fox Underline Yellow (on Green background)
+the quick brown fox Inverse Yellow (on Green background)
+the quick brown fox Bright Blue (on Green background)
+the quick brown fox Underline Blue (on Green background)
+the quick brown fox Inverse Blue (on Green background)
+the quick brown fox Bright Magenta (on Green background)
+the quick brown fox Underline Magenta (on Green background)
+the quick brown fox Inverse Magenta (on Green background)
+the quick brown fox Bright Cyan (on Green background)
+the quick brown fox Underline Cyan (on Green background)
+the quick brown fox Inverse Cyan (on Green background)
+the quick brown fox Bright White (on Green background)
+the quick brown fox Underline White (on Green background)
+the quick brown fox Inverse White (on Green background)
+the quick brown fox Bright Black (on Yellow background)
+the quick brown fox Underline Black (on Yellow background)
+the quick brown fox Inverse Black (on Yellow background)
+the quick brown fox Bright Red (on Yellow background)
+the quick brown fox Underline Red (on Yellow background)
+the quick brown fox Inverse Red (on Yellow background)
+the quick brown fox Bright Green (on Yellow background)
+the quick brown fox Underline Green (on Yellow background)
+the quick brown fox Inverse Green (on Yellow background)
+the quick brown fox Bright Yellow (on Yellow background)
+the quick brown fox Underline Yellow (on Yellow background)
+the quick brown fox Inverse Yellow (on Yellow background)
+the quick brown fox Bright Blue (on Yellow background)
+the quick brown fox Underline Blue (on Yellow background)
+the quick brown fox Inverse Blue (on Yellow background)
+the quick brown fox Bright Magenta (on Yellow background)
+the quick brown fox Underline Magenta (on Yellow background)
+the quick brown fox Inverse Magenta (on Yellow background)
+the quick brown fox Bright Cyan (on Yellow background)
+the quick brown fox Underline Cyan (on Yellow background)
+the quick brown fox Inverse Cyan (on Yellow background)
+the quick brown fox Bright White (on Yellow background)
+the quick brown fox Underline White (on Yellow background)
+the quick brown fox Inverse White (on Yellow background)
+the quick brown fox Bright Black (on Blue background)
+the quick brown fox Underline Black (on Blue background)
+the quick brown fox Inverse Black (on Blue background)
+the quick brown fox Bright Red (on Blue background)
+the quick brown fox Underline Red (on Blue background)
+the quick brown fox Inverse Red (on Blue background)
+the quick brown fox Bright Green (on Blue background)
+the quick brown fox Underline Green (on Blue background)
+the quick brown fox Inverse Green (on Blue background)
+the quick brown fox Bright Yellow (on Blue background)
+the quick brown fox Underline Yellow (on Blue background)
+the quick brown fox Inverse Yellow (on Blue background)
+the quick brown fox Bright Blue (on Blue background)
+the quick brown fox Underline Blue (on Blue background)
+the quick brown fox Inverse Blue (on Blue background)
+the quick brown fox Bright Magenta (on Blue background)
+the quick brown fox Underline Magenta (on Blue background)
+the quick brown fox Inverse Magenta (on Blue background)
+the quick brown fox Bright Cyan (on Blue background)
+the quick brown fox Underline Cyan (on Blue background)
+the quick brown fox Inverse Cyan (on Blue background)
+the quick brown fox Bright White (on Blue background)
+the quick brown fox Underline White (on Blue background)
+the quick brown fox Inverse White (on Blue background)
+the quick brown fox Bright Black (on Magenta background)
+the quick brown fox Underline Black (on Magenta background)
+the quick brown fox Inverse Black (on Magenta background)
+the quick brown fox Bright Red (on Magenta background)
+the quick brown fox Underline Red (on Magenta background)
+the quick brown fox Inverse Red (on Magenta background)
+the quick brown fox Bright Green (on Magenta background)
+the quick brown fox Underline Green (on Magenta background)
+the quick brown fox Inverse Green (on Magenta background)
+the quick brown fox Bright Yellow (on Magenta background)
+the quick brown fox Underline Yellow (on Magenta background)
+the quick brown fox Inverse Yellow (on Magenta background)
+the quick brown fox Bright Blue (on Magenta background)
+the quick brown fox Underline Blue (on Magenta background)
+the quick brown fox Inverse Blue (on Magenta background)
+the quick brown fox Bright Magenta (on Magenta background)
+the quick brown fox Underline Magenta (on Magenta background)
+the quick brown fox Inverse Magenta (on Magenta background)
+the quick brown fox Bright Cyan (on Magenta background)
+the quick brown fox Underline Cyan (on Magenta background)
+the quick brown fox Inverse Cyan (on Magenta background)
+the quick brown fox Bright White (on Magenta background)
+the quick brown fox Underline White (on Magenta background)
+the quick brown fox Inverse White (on Magenta background)
+the quick brown fox Bright Black (on Cyan background)
+the quick brown fox Underline Black (on Cyan background)
+the quick brown fox Inverse Black (on Cyan background)
+the quick brown fox Bright Red (on Cyan background)
+the quick brown fox Underline Red (on Cyan background)
+the quick brown fox Inverse Red (on Cyan background)
+the quick brown fox Bright Green (on Cyan background)
+the quick brown fox Underline Green (on Cyan background)
+the quick brown fox Inverse Green (on Cyan background)
+the quick brown fox Bright Yellow (on Cyan background)
+the quick brown fox Underline Yellow (on Cyan background)
+the quick brown fox Inverse Yellow (on Cyan background)
+the quick brown fox Bright Blue (on Cyan background)
+the quick brown fox Underline Blue (on Cyan background)
+the quick brown fox Inverse Blue (on Cyan background)
+the quick brown fox Bright Magenta (on Cyan background)
+the quick brown fox Underline Magenta (on Cyan background)
+the quick brown fox Inverse Magenta (on Cyan background)
+the quick brown fox Bright Cyan (on Cyan background)
+the quick brown fox Underline Cyan (on Cyan background)
+the quick brown fox Inverse Cyan (on Cyan background)
+the quick brown fox Bright White (on Cyan background)
+the quick brown fox Underline White (on Cyan background)
+the quick brown fox Inverse White (on Cyan background)
+the quick brown fox Bright Black (on White background)
+the quick brown fox Underline Black (on White background)
+the quick brown fox Inverse Black (on White background)
+the quick brown fox Bright Red (on White background)
+the quick brown fox Underline Red (on White background)
+the quick brown fox Inverse Red (on White background)
+the quick brown fox Bright Green (on White background)
+the quick brown fox Underline Green (on White background)
+the quick brown fox Inverse Green (on White background)
+the quick brown fox Bright Yellow (on White background)
+the quick brown fox Underline Yellow (on White background)
+the quick brown fox Inverse Yellow (on White background)
+the quick brown fox Bright Blue (on White background)
+the quick brown fox Underline Blue (on White background)
+the quick brown fox Inverse Blue (on White background)
+the quick brown fox Bright Magenta (on White background)
+the quick brown fox Underline Magenta (on White background)
+the quick brown fox Inverse Magenta (on White background)
+the quick brown fox Bright Cyan (on White background)
+the quick brown fox Underline Cyan (on White background)
+the quick brown fox Inverse Cyan (on White background)
+the quick brown fox Bright White (on White background)
+the quick brown fox Underline White (on White background)
+the quick brown fox Inverse White (on White background)
+
+2 colors 2 effects
+the quick brown fox Bright Underline Black (on Black background)
+the quick brown fox Bright Inverse Black (on Black background)
+the quick brown fox Underline Bright Black (on Black background)
+the quick brown fox Underline Inverse Black (on Black background)
+the quick brown fox Inverse Bright Black (on Black background)
+the quick brown fox Inverse Underline Black (on Black background)
+the quick brown fox Bright Underline Red (on Black background)
+the quick brown fox Bright Inverse Red (on Black background)
+the quick brown fox Underline Bright Red (on Black background)
+the quick brown fox Underline Inverse Red (on Black background)
+the quick brown fox Inverse Bright Red (on Black background)
+the quick brown fox Inverse Underline Red (on Black background)
+the quick brown fox Bright Underline Green (on Black background)
+the quick brown fox Bright Inverse Green (on Black background)
+the quick brown fox Underline Bright Green (on Black background)
+the quick brown fox Underline Inverse Green (on Black background)
+the quick brown fox Inverse Bright Green (on Black background)
+the quick brown fox Inverse Underline Green (on Black background)
+the quick brown fox Bright Underline Yellow (on Black background)
+the quick brown fox Bright Inverse Yellow (on Black background)
+the quick brown fox Underline Bright Yellow (on Black background)
+the quick brown fox Underline Inverse Yellow (on Black background)
+the quick brown fox Inverse Bright Yellow (on Black background)
+the quick brown fox Inverse Underline Yellow (on Black background)
+the quick brown fox Bright Underline Blue (on Black background)
+the quick brown fox Bright Inverse Blue (on Black background)
+the quick brown fox Underline Bright Blue (on Black background)
+the quick brown fox Underline Inverse Blue (on Black background)
+the quick brown fox Inverse Bright Blue (on Black background)
+the quick brown fox Inverse Underline Blue (on Black background)
+the quick brown fox Bright Underline Magenta (on Black background)
+the quick brown fox Bright Inverse Magenta (on Black background)
+the quick brown fox Underline Bright Magenta (on Black background)
+the quick brown fox Underline Inverse Magenta (on Black background)
+the quick brown fox Inverse Bright Magenta (on Black background)
+the quick brown fox Inverse Underline Magenta (on Black background)
+the quick brown fox Bright Underline Cyan (on Black background)
+the quick brown fox Bright Inverse Cyan (on Black background)
+the quick brown fox Underline Bright Cyan (on Black background)
+the quick brown fox Underline Inverse Cyan (on Black background)
+the quick brown fox Inverse Bright Cyan (on Black background)
+the quick brown fox Inverse Underline Cyan (on Black background)
+the quick brown fox Bright Underline White (on Black background)
+the quick brown fox Bright Inverse White (on Black background)
+the quick brown fox Underline Bright White (on Black background)
+the quick brown fox Underline Inverse White (on Black background)
+the quick brown fox Inverse Bright White (on Black background)
+the quick brown fox Inverse Underline White (on Black background)
+the quick brown fox Bright Underline Black (on Red background)
+the quick brown fox Bright Inverse Black (on Red background)
+the quick brown fox Underline Bright Black (on Red background)
+the quick brown fox Underline Inverse Black (on Red background)
+the quick brown fox Inverse Bright Black (on Red background)
+the quick brown fox Inverse Underline Black (on Red background)
+the quick brown fox Bright Underline Red (on Red background)
+the quick brown fox Bright Inverse Red (on Red background)
+the quick brown fox Underline Bright Red (on Red background)
+the quick brown fox Underline Inverse Red (on Red background)
+the quick brown fox Inverse Bright Red (on Red background)
+the quick brown fox Inverse Underline Red (on Red background)
+the quick brown fox Bright Underline Green (on Red background)
+the quick brown fox Bright Inverse Green (on Red background)
+the quick brown fox Underline Bright Green (on Red background)
+the quick brown fox Underline Inverse Green (on Red background)
+the quick brown fox Inverse Bright Green (on Red background)
+the quick brown fox Inverse Underline Green (on Red background)
+the quick brown fox Bright Underline Yellow (on Red background)
+the quick brown fox Bright Inverse Yellow (on Red background)
+the quick brown fox Underline Bright Yellow (on Red background)
+the quick brown fox Underline Inverse Yellow (on Red background)
+the quick brown fox Inverse Bright Yellow (on Red background)
+the quick brown fox Inverse Underline Yellow (on Red background)
+the quick brown fox Bright Underline Blue (on Red background)
+the quick brown fox Bright Inverse Blue (on Red background)
+the quick brown fox Underline Bright Blue (on Red background)
+the quick brown fox Underline Inverse Blue (on Red background)
+the quick brown fox Inverse Bright Blue (on Red background)
+the quick brown fox Inverse Underline Blue (on Red background)
+the quick brown fox Bright Underline Magenta (on Red background)
+the quick brown fox Bright Inverse Magenta (on Red background)
+the quick brown fox Underline Bright Magenta (on Red background)
+the quick brown fox Underline Inverse Magenta (on Red background)
+the quick brown fox Inverse Bright Magenta (on Red background)
+the quick brown fox Inverse Underline Magenta (on Red background)
+the quick brown fox Bright Underline Cyan (on Red background)
+the quick brown fox Bright Inverse Cyan (on Red background)
+the quick brown fox Underline Bright Cyan (on Red background)
+the quick brown fox Underline Inverse Cyan (on Red background)
+the quick brown fox Inverse Bright Cyan (on Red background)
+the quick brown fox Inverse Underline Cyan (on Red background)
+the quick brown fox Bright Underline White (on Red background)
+the quick brown fox Bright Inverse White (on Red background)
+the quick brown fox Underline Bright White (on Red background)
+the quick brown fox Underline Inverse White (on Red background)
+the quick brown fox Inverse Bright White (on Red background)
+the quick brown fox Inverse Underline White (on Red background)
+the quick brown fox Bright Underline Black (on Green background)
+the quick brown fox Bright Inverse Black (on Green background)
+the quick brown fox Underline Bright Black (on Green background)
+the quick brown fox Underline Inverse Black (on Green background)
+the quick brown fox Inverse Bright Black (on Green background)
+the quick brown fox Inverse Underline Black (on Green background)
+the quick brown fox Bright Underline Red (on Green background)
+the quick brown fox Bright Inverse Red (on Green background)
+the quick brown fox Underline Bright Red (on Green background)
+the quick brown fox Underline Inverse Red (on Green background)
+the quick brown fox Inverse Bright Red (on Green background)
+the quick brown fox Inverse Underline Red (on Green background)
+the quick brown fox Bright Underline Green (on Green background)
+the quick brown fox Bright Inverse Green (on Green background)
+the quick brown fox Underline Bright Green (on Green background)
+the quick brown fox Underline Inverse Green (on Green background)
+the quick brown fox Inverse Bright Green (on Green background)
+the quick brown fox Inverse Underline Green (on Green background)
+the quick brown fox Bright Underline Yellow (on Green background)
+the quick brown fox Bright Inverse Yellow (on Green background)
+the quick brown fox Underline Bright Yellow (on Green background)
+the quick brown fox Underline Inverse Yellow (on Green background)
+the quick brown fox Inverse Bright Yellow (on Green background)
+the quick brown fox Inverse Underline Yellow (on Green background)
+the quick brown fox Bright Underline Blue (on Green background)
+the quick brown fox Bright Inverse Blue (on Green background)
+the quick brown fox Underline Bright Blue (on Green background)
+the quick brown fox Underline Inverse Blue (on Green background)
+the quick brown fox Inverse Bright Blue (on Green background)
+the quick brown fox Inverse Underline Blue (on Green background)
+the quick brown fox Bright Underline Magenta (on Green background)
+the quick brown fox Bright Inverse Magenta (on Green background)
+the quick brown fox Underline Bright Magenta (on Green background)
+the quick brown fox Underline Inverse Magenta (on Green background)
+the quick brown fox Inverse Bright Magenta (on Green background)
+the quick brown fox Inverse Underline Magenta (on Green background)
+the quick brown fox Bright Underline Cyan (on Green background)
+the quick brown fox Bright Inverse Cyan (on Green background)
+the quick brown fox Underline Bright Cyan (on Green background)
+the quick brown fox Underline Inverse Cyan (on Green background)
+the quick brown fox Inverse Bright Cyan (on Green background)
+the quick brown fox Inverse Underline Cyan (on Green background)
+the quick brown fox Bright Underline White (on Green background)
+the quick brown fox Bright Inverse White (on Green background)
+the quick brown fox Underline Bright White (on Green background)
+the quick brown fox Underline Inverse White (on Green background)
+the quick brown fox Inverse Bright White (on Green background)
+the quick brown fox Inverse Underline White (on Green background)
+the quick brown fox Bright Underline Black (on Yellow background)
+the quick brown fox Bright Inverse Black (on Yellow background)
+the quick brown fox Underline Bright Black (on Yellow background)
+the quick brown fox Underline Inverse Black (on Yellow background)
+the quick brown fox Inverse Bright Black (on Yellow background)
+the quick brown fox Inverse Underline Black (on Yellow background)
+the quick brown fox Bright Underline Red (on Yellow background)
+the quick brown fox Bright Inverse Red (on Yellow background)
+the quick brown fox Underline Bright Red (on Yellow background)
+the quick brown fox Underline Inverse Red (on Yellow background)
+the quick brown fox Inverse Bright Red (on Yellow background)
+the quick brown fox Inverse Underline Red (on Yellow background)
+the quick brown fox Bright Underline Green (on Yellow background)
+the quick brown fox Bright Inverse Green (on Yellow background)
+the quick brown fox Underline Bright Green (on Yellow background)
+the quick brown fox Underline Inverse Green (on Yellow background)
+the quick brown fox Inverse Bright Green (on Yellow background)
+the quick brown fox Inverse Underline Green (on Yellow background)
+the quick brown fox Bright Underline Yellow (on Yellow background)
+the quick brown fox Bright Inverse Yellow (on Yellow background)
+the quick brown fox Underline Bright Yellow (on Yellow background)
+the quick brown fox Underline Inverse Yellow (on Yellow background)
+the quick brown fox Inverse Bright Yellow (on Yellow background)
+the quick brown fox Inverse Underline Yellow (on Yellow background)
+the quick brown fox Bright Underline Blue (on Yellow background)
+the quick brown fox Bright Inverse Blue (on Yellow background)
+the quick brown fox Underline Bright Blue (on Yellow background)
+the quick brown fox Underline Inverse Blue (on Yellow background)
+the quick brown fox Inverse Bright Blue (on Yellow background)
+the quick brown fox Inverse Underline Blue (on Yellow background)
+the quick brown fox Bright Underline Magenta (on Yellow background)
+the quick brown fox Bright Inverse Magenta (on Yellow background)
+the quick brown fox Underline Bright Magenta (on Yellow background)
+the quick brown fox Underline Inverse Magenta (on Yellow background)
+the quick brown fox Inverse Bright Magenta (on Yellow background)
+the quick brown fox Inverse Underline Magenta (on Yellow background)
+the quick brown fox Bright Underline Cyan (on Yellow background)
+the quick brown fox Bright Inverse Cyan (on Yellow background)
+the quick brown fox Underline Bright Cyan (on Yellow background)
+the quick brown fox Underline Inverse Cyan (on Yellow background)
+the quick brown fox Inverse Bright Cyan (on Yellow background)
+the quick brown fox Inverse Underline Cyan (on Yellow background)
+the quick brown fox Bright Underline White (on Yellow background)
+the quick brown fox Bright Inverse White (on Yellow background)
+the quick brown fox Underline Bright White (on Yellow background)
+the quick brown fox Underline Inverse White (on Yellow background)
+the quick brown fox Inverse Bright White (on Yellow background)
+the quick brown fox Inverse Underline White (on Yellow background)
+the quick brown fox Bright Underline Black (on Blue background)
+the quick brown fox Bright Inverse Black (on Blue background)
+the quick brown fox Underline Bright Black (on Blue background)
+the quick brown fox Underline Inverse Black (on Blue background)
+the quick brown fox Inverse Bright Black (on Blue background)
+the quick brown fox Inverse Underline Black (on Blue background)
+the quick brown fox Bright Underline Red (on Blue background)
+the quick brown fox Bright Inverse Red (on Blue background)
+the quick brown fox Underline Bright Red (on Blue background)
+the quick brown fox Underline Inverse Red (on Blue background)
+the quick brown fox Inverse Bright Red (on Blue background)
+the quick brown fox Inverse Underline Red (on Blue background)
+the quick brown fox Bright Underline Green (on Blue background)
+the quick brown fox Bright Inverse Green (on Blue background)
+the quick brown fox Underline Bright Green (on Blue background)
+the quick brown fox Underline Inverse Green (on Blue background)
+the quick brown fox Inverse Bright Green (on Blue background)
+the quick brown fox Inverse Underline Green (on Blue background)
+the quick brown fox Bright Underline Yellow (on Blue background)
+the quick brown fox Bright Inverse Yellow (on Blue background)
+the quick brown fox Underline Bright Yellow (on Blue background)
+the quick brown fox Underline Inverse Yellow (on Blue background)
+the quick brown fox Inverse Bright Yellow (on Blue background)
+the quick brown fox Inverse Underline Yellow (on Blue background)
+the quick brown fox Bright Underline Blue (on Blue background)
+the quick brown fox Bright Inverse Blue (on Blue background)
+the quick brown fox Underline Bright Blue (on Blue background)
+the quick brown fox Underline Inverse Blue (on Blue background)
+the quick brown fox Inverse Bright Blue (on Blue background)
+the quick brown fox Inverse Underline Blue (on Blue background)
+the quick brown fox Bright Underline Magenta (on Blue background)
+the quick brown fox Bright Inverse Magenta (on Blue background)
+the quick brown fox Underline Bright Magenta (on Blue background)
+the quick brown fox Underline Inverse Magenta (on Blue background)
+the quick brown fox Inverse Bright Magenta (on Blue background)
+the quick brown fox Inverse Underline Magenta (on Blue background)
+the quick brown fox Bright Underline Cyan (on Blue background)
+the quick brown fox Bright Inverse Cyan (on Blue background)
+the quick brown fox Underline Bright Cyan (on Blue background)
+the quick brown fox Underline Inverse Cyan (on Blue background)
+the quick brown fox Inverse Bright Cyan (on Blue background)
+the quick brown fox Inverse Underline Cyan (on Blue background)
+the quick brown fox Bright Underline White (on Blue background)
+the quick brown fox Bright Inverse White (on Blue background)
+the quick brown fox Underline Bright White (on Blue background)
+the quick brown fox Underline Inverse White (on Blue background)
+the quick brown fox Inverse Bright White (on Blue background)
+the quick brown fox Inverse Underline White (on Blue background)
+the quick brown fox Bright Underline Black (on Magenta background)
+the quick brown fox Bright Inverse Black (on Magenta background)
+the quick brown fox Underline Bright Black (on Magenta background)
+the quick brown fox Underline Inverse Black (on Magenta background)
+the quick brown fox Inverse Bright Black (on Magenta background)
+the quick brown fox Inverse Underline Black (on Magenta background)
+the quick brown fox Bright Underline Red (on Magenta background)
+the quick brown fox Bright Inverse Red (on Magenta background)
+the quick brown fox Underline Bright Red (on Magenta background)
+the quick brown fox Underline Inverse Red (on Magenta background)
+the quick brown fox Inverse Bright Red (on Magenta background)
+the quick brown fox Inverse Underline Red (on Magenta background)
+the quick brown fox Bright Underline Green (on Magenta background)
+the quick brown fox Bright Inverse Green (on Magenta background)
+the quick brown fox Underline Bright Green (on Magenta background)
+the quick brown fox Underline Inverse Green (on Magenta background)
+the quick brown fox Inverse Bright Green (on Magenta background)
+the quick brown fox Inverse Underline Green (on Magenta background)
+the quick brown fox Bright Underline Yellow (on Magenta background)
+the quick brown fox Bright Inverse Yellow (on Magenta background)
+the quick brown fox Underline Bright Yellow (on Magenta background)
+the quick brown fox Underline Inverse Yellow (on Magenta background)
+the quick brown fox Inverse Bright Yellow (on Magenta background)
+the quick brown fox Inverse Underline Yellow (on Magenta background)
+the quick brown fox Bright Underline Blue (on Magenta background)
+the quick brown fox Bright Inverse Blue (on Magenta background)
+the quick brown fox Underline Bright Blue (on Magenta background)
+the quick brown fox Underline Inverse Blue (on Magenta background)
+the quick brown fox Inverse Bright Blue (on Magenta background)
+the quick brown fox Inverse Underline Blue (on Magenta background)
+the quick brown fox Bright Underline Magenta (on Magenta background)
+the quick brown fox Bright Inverse Magenta (on Magenta background)
+the quick brown fox Underline Bright Magenta (on Magenta background)
+the quick brown fox Underline Inverse Magenta (on Magenta background)
+the quick brown fox Inverse Bright Magenta (on Magenta background)
+the quick brown fox Inverse Underline Magenta (on Magenta background)
+the quick brown fox Bright Underline Cyan (on Magenta background)
+the quick brown fox Bright Inverse Cyan (on Magenta background)
+the quick brown fox Underline Bright Cyan (on Magenta background)
+the quick brown fox Underline Inverse Cyan (on Magenta background)
+the quick brown fox Inverse Bright Cyan (on Magenta background)
+the quick brown fox Inverse Underline Cyan (on Magenta background)
+the quick brown fox Bright Underline White (on Magenta background)
+the quick brown fox Bright Inverse White (on Magenta background)
+the quick brown fox Underline Bright White (on Magenta background)
+the quick brown fox Underline Inverse White (on Magenta background)
+the quick brown fox Inverse Bright White (on Magenta background)
+the quick brown fox Inverse Underline White (on Magenta background)
+the quick brown fox Bright Underline Black (on Cyan background)
+the quick brown fox Bright Inverse Black (on Cyan background)
+the quick brown fox Underline Bright Black (on Cyan background)
+the quick brown fox Underline Inverse Black (on Cyan background)
+the quick brown fox Inverse Bright Black (on Cyan background)
+the quick brown fox Inverse Underline Black (on Cyan background)
+the quick brown fox Bright Underline Red (on Cyan background)
+the quick brown fox Bright Inverse Red (on Cyan background)
+the quick brown fox Underline Bright Red (on Cyan background)
+the quick brown fox Underline Inverse Red (on Cyan background)
+the quick brown fox Inverse Bright Red (on Cyan background)
+the quick brown fox Inverse Underline Red (on Cyan background)
+the quick brown fox Bright Underline Green (on Cyan background)
+the quick brown fox Bright Inverse Green (on Cyan background)
+the quick brown fox Underline Bright Green (on Cyan background)
+the quick brown fox Underline Inverse Green (on Cyan background)
+the quick brown fox Inverse Bright Green (on Cyan background)
+the quick brown fox Inverse Underline Green (on Cyan background)
+the quick brown fox Bright Underline Yellow (on Cyan background)
+the quick brown fox Bright Inverse Yellow (on Cyan background)
+the quick brown fox Underline Bright Yellow (on Cyan background)
+the quick brown fox Underline Inverse Yellow (on Cyan background)
+the quick brown fox Inverse Bright Yellow (on Cyan background)
+the quick brown fox Inverse Underline Yellow (on Cyan background)
+the quick brown fox Bright Underline Blue (on Cyan background)
+the quick brown fox Bright Inverse Blue (on Cyan background)
+the quick brown fox Underline Bright Blue (on Cyan background)
+the quick brown fox Underline Inverse Blue (on Cyan background)
+the quick brown fox Inverse Bright Blue (on Cyan background)
+the quick brown fox Inverse Underline Blue (on Cyan background)
+the quick brown fox Bright Underline Magenta (on Cyan background)
+the quick brown fox Bright Inverse Magenta (on Cyan background)
+the quick brown fox Underline Bright Magenta (on Cyan background)
+the quick brown fox Underline Inverse Magenta (on Cyan background)
+the quick brown fox Inverse Bright Magenta (on Cyan background)
+the quick brown fox Inverse Underline Magenta (on Cyan background)
+the quick brown fox Bright Underline Cyan (on Cyan background)
+the quick brown fox Bright Inverse Cyan (on Cyan background)
+the quick brown fox Underline Bright Cyan (on Cyan background)
+the quick brown fox Underline Inverse Cyan (on Cyan background)
+the quick brown fox Inverse Bright Cyan (on Cyan background)
+the quick brown fox Inverse Underline Cyan (on Cyan background)
+the quick brown fox Bright Underline White (on Cyan background)
+the quick brown fox Bright Inverse White (on Cyan background)
+the quick brown fox Underline Bright White (on Cyan background)
+the quick brown fox Underline Inverse White (on Cyan background)
+the quick brown fox Inverse Bright White (on Cyan background)
+the quick brown fox Inverse Underline White (on Cyan background)
+the quick brown fox Bright Underline Black (on White background)
+the quick brown fox Bright Inverse Black (on White background)
+the quick brown fox Underline Bright Black (on White background)
+the quick brown fox Underline Inverse Black (on White background)
+the quick brown fox Inverse Bright Black (on White background)
+the quick brown fox Inverse Underline Black (on White background)
+the quick brown fox Bright Underline Red (on White background)
+the quick brown fox Bright Inverse Red (on White background)
+the quick brown fox Underline Bright Red (on White background)
+the quick brown fox Underline Inverse Red (on White background)
+the quick brown fox Inverse Bright Red (on White background)
+the quick brown fox Inverse Underline Red (on White background)
+the quick brown fox Bright Underline Green (on White background)
+the quick brown fox Bright Inverse Green (on White background)
+the quick brown fox Underline Bright Green (on White background)
+the quick brown fox Underline Inverse Green (on White background)
+the quick brown fox Inverse Bright Green (on White background)
+the quick brown fox Inverse Underline Green (on White background)
+the quick brown fox Bright Underline Yellow (on White background)
+the quick brown fox Bright Inverse Yellow (on White background)
+the quick brown fox Underline Bright Yellow (on White background)
+the quick brown fox Underline Inverse Yellow (on White background)
+the quick brown fox Inverse Bright Yellow (on White background)
+the quick brown fox Inverse Underline Yellow (on White background)
+the quick brown fox Bright Underline Blue (on White background)
+the quick brown fox Bright Inverse Blue (on White background)
+the quick brown fox Underline Bright Blue (on White background)
+the quick brown fox Underline Inverse Blue (on White background)
+the quick brown fox Inverse Bright Blue (on White background)
+the quick brown fox Inverse Underline Blue (on White background)
+the quick brown fox Bright Underline Magenta (on White background)
+the quick brown fox Bright Inverse Magenta (on White background)
+the quick brown fox Underline Bright Magenta (on White background)
+the quick brown fox Underline Inverse Magenta (on White background)
+the quick brown fox Inverse Bright Magenta (on White background)
+the quick brown fox Inverse Underline Magenta (on White background)
+the quick brown fox Bright Underline Cyan (on White background)
+the quick brown fox Bright Inverse Cyan (on White background)
+the quick brown fox Underline Bright Cyan (on White background)
+the quick brown fox Underline Inverse Cyan (on White background)
+the quick brown fox Inverse Bright Cyan (on White background)
+the quick brown fox Inverse Underline Cyan (on White background)
+the quick brown fox Bright Underline White (on White background)
+the quick brown fox Bright Inverse White (on White background)
+the quick brown fox Underline Bright White (on White background)
+the quick brown fox Underline Inverse White (on White background)
+the quick brown fox Inverse Bright White (on White background)
+the quick brown fox Inverse Underline White (on White background)
diff --git a/test/files/run/color.scala b/test/files/run/color.scala
new file mode 100644
index 0000000000..a0af8477e7
--- /dev/null
+++ b/test/files/run/color.scala
@@ -0,0 +1,33 @@
+import scala.tools.util.color._
+
+object Test {
+ // The ones which are somewhat widely supported.
+ def effects = List(Bright, Underline, Inverse)
+
+ def demo(text: String) = {
+ def to_s(esc: Ansi): String = esc.atoms map {
+ case x: AnsiBackground => "" + x
+ case x => "%-10s" format x
+ } mkString " "
+
+ def show(esc: Ansi) = println("%s %s".format(text in esc, to_s(esc)))
+
+ println("\n1 color")
+ for (c <- Ansi.colors) show(c)
+ println("\n1 effect")
+ for (e <- Ansi.effects) show(e)
+ println("\n1 color 1 effect")
+ for (c <- Ansi.colors; e <- effects) show(c / e)
+ println("\n2 colors 0 effects")
+ for (c1 <- Ansi.colors ; c2 <- Ansi.colors) show(c2 on c1)
+ println("\n2 colors 1 effect")
+ for (c1 <- Ansi.colors ; c2 <- Ansi.colors ; e1 <- effects) show((c2 on c1) / e1)
+ println("\n2 colors 2 effects")
+ for (c1 <- Ansi.colors ; c2 <- Ansi.colors ; e1 <- effects ; e2 <- effects ; if e1 != e2) show((c2 on c1) / e1 / e2)
+ }
+
+ def main(args: Array[String]): Unit = {
+ val str = if (args.size > 1) args mkString " " else "the quick brown fox"
+ demo(str)
+ }
+}