Skip to content

std/color ​

ANSI terminal color and style formatting.

milo
from "std/color" import { Color }

Example ​

milo
print(Color.bold(Color.red("error:")) + " something went wrong")
print(Color.green("ok") + " " + Color.dim("(3 tests passed)"))

API reference ​

Color ​

milo
pub struct Color

Color namespace — SGR text styling (Color.red(s), Color.bold(s), ...).

Color.bgBlue ​

milo
fn Color.bgBlue(s: &string): string

Color.bgGreen ​

milo
fn Color.bgGreen(s: &string): string

Color.bgRed ​

milo
fn Color.bgRed(s: &string): string

Color.bgYellow ​

milo
fn Color.bgYellow(s: &string): string

Color.blue ​

milo
fn Color.blue(s: &string): string

Color.bold ​

milo
fn Color.bold(s: &string): string

Color.cyan ​

milo
fn Color.cyan(s: &string): string

Color.dim ​

milo
fn Color.dim(s: &string): string

Color.gray ​

milo
fn Color.gray(s: &string): string

Color.green ​

milo
fn Color.green(s: &string): string

Color.italic ​

milo
fn Color.italic(s: &string): string

Color.magenta ​

milo
fn Color.magenta(s: &string): string

Color.red ​

milo
fn Color.red(s: &string): string

Color.strikethrough ​

milo
fn Color.strikethrough(s: &string): string

Color.underline ​

milo
fn Color.underline(s: &string): string

Color.white ​

milo
fn Color.white(s: &string): string

Color.yellow ​

milo
fn Color.yellow(s: &string): string