| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // TODO(ahe): Copied from sdk/pkg/compiler/lib/src/colors.dart. |
| 6 library colors; |
| 7 |
| 8 // See http://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes |
| 9 const String RESET = '\u001b[0m'; |
| 10 |
| 11 // See http://en.wikipedia.org/wiki/ANSI_escape_code#Colors |
| 12 const String BLACK_COLOR = '\u001b[30m'; |
| 13 const String RED_COLOR = '\u001b[31m'; |
| 14 const String GREEN_COLOR = '\u001b[32m'; |
| 15 const String YELLOW_COLOR = '\u001b[33m'; |
| 16 const String BLUE_COLOR = '\u001b[34m'; |
| 17 const String MAGENTA_COLOR = '\u001b[35m'; |
| 18 const String CYAN_COLOR = '\u001b[36m'; |
| 19 const String WHITE_COLOR = '\u001b[37m'; |
| 20 |
| 21 String wrap(String string, String color) => "${color}$string${RESET}"; |
| 22 |
| 23 String black(String string) => wrap(string, BLACK_COLOR); |
| 24 String red(String string) => wrap(string, RED_COLOR); |
| 25 String green(String string) => wrap(string, GREEN_COLOR); |
| 26 String yellow(String string) => wrap(string, YELLOW_COLOR); |
| 27 String blue(String string) => wrap(string, BLUE_COLOR); |
| 28 String magenta(String string) => wrap(string, MAGENTA_COLOR); |
| 29 String cyan(String string) => wrap(string, CYAN_COLOR); |
| 30 String white(String string) => wrap(string, WHITE_COLOR); |
| OLD | NEW |