Documentation ¶
Overview ¶
Package term provides information about the terminal that the current process is connected to (if any), for example measuring the dimensions of the terminal and inspecting whether it's safe to output color.
Index ¶
- func IsColorDisabled() bool
- func IsTerminal(f *os.File) bool
- type Term
- func (t Term) ErrOut() io.Writer
- func (t Term) In() io.Reader
- func (t Term) Is256ColorSupported() bool
- func (t Term) IsColorEnabled() bool
- func (t Term) IsTerminalOutput() bool
- func (t Term) IsTrueColorSupported() bool
- func (t Term) Out() io.Writer
- func (t Term) Size() (int, int, error)
- func (t Term) Theme() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsColorDisabled ¶
func IsColorDisabled() bool
IsColorDisabled returns true if environment variables NO_COLOR or CLICOLOR prohibit usage of color codes in terminal output.
func IsTerminal ¶
IsTerminal reports whether a file descriptor is connected to a terminal.
Types ¶
type Term ¶
type Term struct {
// contains filtered or unexported fields
}
Term represents information about the terminal that a process is connected to.
func FromEnv ¶
func FromEnv() Term
FromEnv initializes a Term from os.Stdout and environment variables:
- GH_FORCE_TTY
- NO_COLOR
- CLICOLOR
- CLICOLOR_FORCE
- TERM
- COLORTERM
func (Term) Is256ColorSupported ¶
Is256ColorSupported reports whether the terminal advertises ANSI 256 color codes.
func (Term) IsColorEnabled ¶
IsColorEnabled reports whether it's safe to output ANSI color sequences, depending on IsTerminalOutput and environment variables.
func (Term) IsTerminalOutput ¶
IsTerminalOutput returns true if standard output is connected to a terminal.
func (Term) IsTrueColorSupported ¶
IsTrueColorSupported reports whether the terminal advertises support for ANSI true color sequences.