Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · term

Docs

std/term

On this page

Index

Types

Painter

struct Painter {
  on: Bool
}

Wraps text in ANSI styles when on, else returns it unchanged. Make one with painter; Painter{on: false} in tests.

Source: std/term.xo:10

Painter.bold

fn (p: Painter) bold(s: Str) -> Str

Source: std/term.xo:21

Painter.dim

fn (p: Painter) dim(s: Str) -> Str

Source: std/term.xo:22

Painter.underline

fn (p: Painter) underline(s: Str) -> Str

Source: std/term.xo:23

Painter.red

fn (p: Painter) red(s: Str) -> Str

Source: std/term.xo:24

Painter.green

fn (p: Painter) green(s: Str) -> Str

Source: std/term.xo:25

Painter.yellow

fn (p: Painter) yellow(s: Str) -> Str

Source: std/term.xo:26

Painter.blue

fn (p: Painter) blue(s: Str) -> Str

Source: std/term.xo:27

Painter.magenta

fn (p: Painter) magenta(s: Str) -> Str

Source: std/term.xo:28

Painter.cyan

fn (p: Painter) cyan(s: Str) -> Str

Source: std/term.xo:29

Painter.gray

fn (p: Painter) gray(s: Str) -> Str

Source: std/term.xo:30

Functions

color_enabled

fn color_enabled(out: Stdio, env: Env) -> Bool uses (stdio, env)

Whether to color standard output: NO_COLOR set and not empty is off; FORCE_COLOR or CLICOLOR_FORCE set, not empty, and not “0” is on; TERM=dumb is off; otherwise on when standard output is a terminal.

Source: std/term.xo:17

painter

fn painter(out: Stdio, env: Env) -> Painter uses (stdio, env)

A Painter that colors when color_enabled(out, env).

Source: std/term.xo:19

strip

fn strip(s: Str) -> Str

s without ANSI escape sequences (to measure or log painted text).

Source: std/term.xo:33

↑ index