Color
Terminal color formatting — returns styled strings.
Methods
| Method | Returns | Description |
|---|---|---|
Color.red(s) | string | Red text |
Color.green(s) | string | Green text |
Color.yellow(s) | string | Yellow text |
Color.blue(s) | string | Blue text |
Color.magenta(s) | string | Magenta text |
Color.cyan(s) | string | Cyan text |
Color.gray(s) | string | Gray text |
Color.bold(s) | string | Bold text |
Color.dim(s) | string | Dim text |
Color.underline(s) | string | Underlined text |
Examples
wyn
println(Color.bold("=== My App ==="))
println(Color.red("Error: file not found"))
println(Color.yellow("Warning: deprecated"))
println(Color.green("Success!"))
println(Color.cyan("Info: ") + "server running on port 8080")
println(Color.gray("debug: gc completed"))Composing
Colors return strings, so they compose naturally:
wyn
var header = Color.bold(Color.cyan("myapp"))
var status = Color.green("ok")
println("${header} -- ${status}")