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

color

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset   = "\033[0m"
	Red     = "\033[31m"
	Green   = "\033[32m"
	Yellow  = "\033[33m"
	Blue    = "\033[34m"
	Magenta = "\033[35m"
	Cyan    = "\033[36m"
	White   = "\033[37m"
	Bold    = "\033[1m"
)

ANSI color codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

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

Color represents a colorizer that can be enabled or disabled

func New

func New(enabled bool) *Color

New creates a new Color instance

func (*Color) Add

func (c *Color) Add(text string) string

Add colors a string to indicate additions (green, like Terraform)

func (*Color) Blue

func (c *Color) Blue(text string) string

Blue colors text blue

func (*Color) Bold

func (c *Color) Bold(text string) string

Bold makes text bold

func (*Color) Change

func (c *Color) Change(text string) string

Change colors a string to indicate modifications (yellow, like Terraform)

func (*Color) Cyan

func (c *Color) Cyan(text string) string

Cyan colors text cyan (for headers and labels)

func (*Color) Destroy

func (c *Color) Destroy(text string) string

Destroy colors a string to indicate deletions (red, like Terraform)

func (*Color) FormatPlanHeader

func (c *Color) FormatPlanHeader(added, modified, dropped int) string

FormatPlanHeader formats the main plan header

func (*Color) FormatPlanLine

func (c *Color) FormatPlanLine(symbol, objectType, name, action string) string

FormatPlanLine formats a line in Terraform plan style

func (*Color) FormatSummaryLine

func (c *Color) FormatSummaryLine(objectType string, added, modified, dropped int) string

FormatSummaryLine formats summary counts with colors

func (*Color) PlanSymbol

func (c *Color) PlanSymbol(action string) string

PlanSymbol returns the appropriate symbol for plan actions

Jump to

Keyboard shortcuts

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