package terminal

import "github.com/gohugoio/hugo/common/terminal"

Package terminal contains helper for the terminal, such as coloring output.

Index

Functions

func Error

func Error(s string) string

Error colorizes the string in a colour that grabs attention.

func IsTerminal

func IsTerminal(f *os.File) bool

IsTerminal return true if the file descriptor is terminal and the TERM environment variable isn't a dumb one.

func Notice

func Notice(s string) string

Notice colorizes the string in a noticeable color.

func PrintANSIColors

func PrintANSIColors(f *os.File) bool

PrintANSIColors returns false if NO_COLOR env variable is set, else IsTerminal(f).

func ReportProgress

func ReportProgress(w io.Writer, state ProgressState, progress float64)

ReportProgress writes OSC 9;4 sequence to w.

func Warning

func Warning(s string) string

Warning colorizes the string in a colour that warns.

Types

type ProgressState

type ProgressState int
const (
	ProgressHidden ProgressState = iota
	ProgressNormal
	ProgressError
	ProgressIntermediate
	ProgressWarning
)

Source Files

colors.go

Version
v0.153.4 (latest)
Published
Dec 28, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
4 months ago

Tools for package owners.