std/term
On this page
Index
- type
Painter- method
Painter.bold - method
Painter.dim - method
Painter.underline - method
Painter.red - method
Painter.green - method
Painter.yellow - method
Painter.blue - method
Painter.magenta - method
Painter.cyan - method
Painter.gray
- method
- fn
color_enabled - fn
painter - fn
strip
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.
Painter.bold
fn (p: Painter) bold(s: Str) -> StrPainter.dim
fn (p: Painter) dim(s: Str) -> StrPainter.underline
fn (p: Painter) underline(s: Str) -> StrPainter.red
fn (p: Painter) red(s: Str) -> StrPainter.green
fn (p: Painter) green(s: Str) -> StrPainter.yellow
fn (p: Painter) yellow(s: Str) -> StrPainter.blue
fn (p: Painter) blue(s: Str) -> StrPainter.magenta
fn (p: Painter) magenta(s: Str) -> StrPainter.cyan
fn (p: Painter) cyan(s: Str) -> StrPainter.gray
fn (p: Painter) gray(s: Str) -> StrFunctions
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.
painter
fn painter(out: Stdio, env: Env) -> Painter uses (stdio, env)A Painter that colors when color_enabled(out, env).
strip
fn strip(s: Str) -> Strs without ANSI escape sequences (to measure or log painted text).
↑ index