terminal

package
v1.9.1 Latest Latest
Warning

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

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

Documentation

Overview

Package terminal styles command output for terminals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorEnabled

func ColorEnabled(f *os.File) bool

ColorEnabled reports whether f is a terminal and NO_COLOR is unset, following the https://no-color.org convention.

func Wrap

func Wrap(text string, indent string, width int) string

Wrap breaks text into lines of at most width columns, each prefixed with indent. A word longer than the width gets a line of its own.

Types

type Palette

type Palette struct {
	// contains filtered or unexported fields
}

Palette styles text with ANSI colors, or leaves it plain when disabled.

func NewPalette

func NewPalette(enabled bool) Palette

NewPalette returns a palette that styles text only when enabled.

func (Palette) Bold

func (p Palette) Bold(text string) string

Bold styles text as bold.

func (Palette) Cyan

func (p Palette) Cyan(text string) string

Cyan colors text cyan.

func (Palette) Dim

func (p Palette) Dim(text string) string

Dim styles text as dim.

func (Palette) Green

func (p Palette) Green(text string) string

Green colors text green.

func (Palette) Red

func (p Palette) Red(text string) string

Red colors text red.

func (Palette) Yellow

func (p Palette) Yellow(text string) string

Yellow colors text yellow.

Jump to

Keyboard shortcuts

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