TermColor.Detect: conservative terminal selection and output #
Detection follows common command-line conventions: NO_COLOR wins over FORCE_COLOR and
disables colors while retaining text attributes on a TTY, a non-empty FORCE_COLOR enables ANSI
output even when stdout is redirected, and TERM=dumb disables all styling. This is policy, not
part of the pure rendering model, so callers can always pass an explicit RenderTarget instead.
Policy for choosing whether to emit terminal colors.
- auto : ColorChoice
Detect the environment and TTY status.
- always : ColorChoice
Force styled output when supported.
- never : ColorChoice
Force plain output.
Instances For
Equations
Equations
- TermColor.instBEqColorChoice.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Choose a render target from the environment and a caller-supplied TTY result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Choose a render target from the current process environment and stdout.
Equations
- TermColor.target choice = do let __do_lift ← liftM IO.getStdout let __do_lift ← liftM __do_lift.isTty TermColor.targetWithTty choice __do_lift
Instances For
Render text using explicit or automatically detected output policy.
Equations
- TermColor.render text choice = do let __do_lift ← TermColor.target choice pure (TermColor.Text.render __do_lift text)
Instances For
Print text using explicit or automatically detected output policy.
Equations
- TermColor.print text choice = do let __do_lift ← TermColor.render text choice IO.print __do_lift