Help us shape the future of Go! Take the 2026 Go Developer Survey

style

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package style adds ANSI colour to human terminal output. It is pure: the caller decides whether a stream gets colour (see cli.DefaultEnv), and a disabled Styler returns every string unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Styler

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

Styler wraps text in SGR escape codes. The zero value is disabled.

func New

func New(enabled, truecolor bool) Styler

New returns a Styler. truecolor picks 24-bit colours over the basic bright ANSI ones; it has no effect when enabled is false.

func (Styler) Bold

func (s Styler) Bold(text string) string

Bold is bold text.

func (Styler) Dim

func (s Styler) Dim(text string) string

Dim is faint text.

func (Styler) Fail

func (s Styler) Fail(text string) string

Fail is red.

func (Styler) OK

func (s Styler) OK(text string) string

OK is lime green.

func (Styler) Warn

func (s Styler) Warn(text string) string

Warn is yellow.

Jump to

Keyboard shortcuts

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