colors

package
v0.0.183 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoColors = Style{
	Header:         noOpANSI,
	Comment:        noOpANSI,
	LogCategory:    noOpANSI,
	LogCachedName:  noOpANSI,
	Progress:       noOpANSI,
	LogArgument:    noOpANSI,
	LogResult:      noOpANSI,
	LogErrorReason: noOpANSI,
	LogError:       noOpANSI,
	LogScope:       noOpANSI,
	ErrorHeader:    noOpANSI,
	LessRelevant:   noOpANSI,
	Highlight:      noOpANSI,
	ErrorWhat:      noOpANSI,
	TestSuccess:    noOpANSI,
	TestFailure:    noOpANSI,
}
View Source
var WithColors = Style{
	Header:         aec.LightBlackF,
	Comment:        aec.LightBlackF,
	LogCategory:    aec.LightBlueF,
	LogCachedName:  aec.LightBlackF,
	Progress:       aec.LightBlackF,
	LogArgument:    aec.CyanF,
	LogResult:      aec.BlueF,
	LogErrorReason: aec.BlueF,
	LogError:       aec.RedF,
	LogScope:       aec.Italic,
	ErrorHeader:    aec.RedF.With(aec.Bold),
	LessRelevant:   aec.Italic,
	Highlight:      aec.Bold,
	ErrorWhat:      aec.MagentaF,
	TestSuccess:    aec.GreenF,
	TestFailure:    aec.RedF,
}

Functions

func WithStyle

func WithStyle(ctx context.Context, s Style) context.Context

Types

type Applicable

type Applicable interface {
	Apply(string) string
}

type Style

type Style struct {
	Header         Applicable // Timestamps, etc.
	Comment        Applicable // Faded out, at the end of a line.
	Progress       Applicable // Inline content that is updated w/ progress.
	ErrorHeader    Applicable // Error prefixes.
	LessRelevant   Applicable // A passing detail, like the fact that a list is empty.
	Highlight      Applicable // Something we should highlight, usually in bold.
	ErrorWhat      Applicable // When formatting errors, the kind of error.
	LogError       Applicable // An error displayed in a log line.
	LogCategory    Applicable // Log line category.
	LogCachedName  Applicable // Names, when cached.
	LogArgument    Applicable // An argument to an invocation.
	LogResult      Applicable // The result of an invocation.
	LogErrorReason Applicable // An expected error reason.
	LogScope       Applicable // Highlight of a package for which an invocation is being made.
	TestSuccess    Applicable // It says it on the tin.
	TestFailure    Applicable // Here too.
}

func Ctx

func Ctx(ctx context.Context) Style

Jump to

Keyboard shortcuts

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