term

package
v0.1.0-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package term says whether a file is a terminal a person reads, and whether it shows colours, for the console lines a logger writes beside the store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Colors

func Colors(f *os.File) bool

Colors says whether f shows ANSI colours: a terminal, without NO_COLOR (no-color.org) or a TERM of dumb. On Windows it asks the console to read escape sequences, which a console from before Windows Terminal prints as text unless asked.

FORCE_COLOR other than 0 turns them on where f is a pipe whose reader shows them, as an IDE's run console does; NO_COLOR and a dumb TERM still win.

NO_COLOR=1          off
TERM=dumb           off
FORCE_COLOR=1       on, a pipe or a file too
a terminal          on
anything else       off

func Forced

func Forced() bool

Forced says whether FORCE_COLOR asks for colours: set, and not 0.

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal says whether f is a character device, a console or a terminal, rather than a pipe or a file. The null device is one too, and nobody reads what goes there.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL