Skip to content

Color ​

Terminal color formatting - returns styled strings.

Methods ​

MethodReturnsDescription
Color.red(s)stringRed text
Color.green(s)stringGreen text
Color.yellow(s)stringYellow text
Color.blue(s)stringBlue text
Color.magenta(s)stringMagenta text
Color.cyan(s)stringCyan text
Color.gray(s)stringGray text
Color.bold(s)stringBold text
Color.dim(s)stringDim text
Color.underline(s)stringUnderlined text

Examples ​

wyn
print(Color.bold("=== My App ==="))
print(Color.red("Error: file not found"))
print(Color.yellow("Warning: deprecated"))
print(Color.green("Success!"))
print(Color.cyan("Info: ") + "server running on port 8080")
print(Color.gray("debug: gc completed"))

Composing ​

Colors return strings, so they compose naturally:

wyn
header = Color.bold(Color.cyan("myapp"))
status = Color.green("ok")
print("${header} -- ${status}")

See Also ​

MIT License - v1.22.0