termcolor

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package termcolor is the single source of truth for the Gothic CLI's terminal colors. Every colored CLI log — the WASM build lines, the deploy output, and the OpenTofu stream colorizer — draws from this one palette and this one enable check, so the whole tool reads as a single, coherent surface.

Index

Constants

View Source
const (
	Reset = "\033[0m"
	Bold  = "\033[1m"
	Under = "\033[4m"

	White  = "\033[37m"       // timestamps / neutral
	Cyan   = "\033[36m"       // names, values, URLs
	Red    = "\033[31m"       // errors, destroy
	Yellow = "\033[33m"       // warnings, update/replace
	Green  = "\033[38;5;120m" // success, create
	Blue   = "\033[38;5;75m"  // secondary numbers
	Purple = "\033[38;5;183m" // Gothic accent / rules / the WASM tag
	Gray   = "\033[38;5;244m" // dim / secondary text / diff comments
)

The canonical Gothic palette. 256-color codes are used for the accent, dim, green and blue so the look is consistent across capable terminals; the primary colors stay on the 16-color codes for maximum compatibility.

Variables

View Source
var Enabled = supported()

Enabled reports whether ANSI color should be emitted. It is resolved once at process start: true only for an interactive terminal, and false under NO_COLOR / GOTHIC_NO_COLOR or when stdout is redirected (a pipe, a file, CI) so those logs stay clean.

Functions

func Code

func Code(code string) string

Code returns the ANSI code when color is enabled, or "" when it is not. It lets callers that build format strings with inline escapes (rather than wrapping a finished string) still honor the enable check: an empty code is a no-op.

func Paint

func Paint(codes, s string) string

Paint wraps s in the given ANSI codes, or returns it unchanged when color is disabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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