colour

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package colour implements basic text colouring for msg's limited needs.

In particular, it's not expected to provide every ANSI code, just the ones we need. The codes have also been padded so that they are the same length, which means text/tabwriter will correctly calculate alignment as long as styles are not mixed within a table cell.

The functions in this package respect both $NO_COLOR and $FORCE_COLOR.

Index

Constants

View Source
const (
	CodeError   = "\x1b[1;0031m" // Bold red, used for the error status
	CodeTitle   = "\x1b[1;0096m" // Bold hi cyan, used for titles
	CodeInfo    = "\x1b[1;0036m" // Bold cyan, used for info
	CodeWarn    = "\x1b[1;0033m" // Bold yellow, used for warn
	CodeSuccess = "\x1b[1;0032m" // Bold geen, used for success
	CodeReset   = "\x1b[000000m" // Reset all attributes
)

ANSI codes for coloured output, they are all the same length so as not to throw off alignment of text/tabwriter.

Variables

This section is empty.

Functions

func Error

func Error(text string) string

Error returns an error styled string.

func Info

func Info(text string) string

Info returns an info styled string.

func Success

func Success(text string) string

Success returns a success styled string.

func Title

func Title(text string) string

Title returns a title styled string.

func Warn

func Warn(text string) string

Warn returns a warn styled string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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