style

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package style provide display coloring

Index

Constants

This section is empty.

Variables

View Source
var (
	Default string = ""

	Black   string = "black"
	Red     string = "red"
	Green   string = "green"
	Yellow  string = "yellow"
	Blue    string = "blue"
	Magenta string = "magenta"
	Cyan    string = "cyan"
	White   string = "white"
	Gray    string = Of(Dim, White)

	BrightBlack   string = "bright-black"
	BrightRed     string = "bright-red"
	BrightGreen   string = "bright-green"
	BrightYellow  string = "bright-yellow"
	BrightBlue    string = "bright-blue"
	BrightMagenta string = "bright-magenta"
	BrightCyan    string = "bright-cyan"
	BrightWhite   string = "bright-white"

	BgBlack   string = "bg-black"
	BgRed     string = "bg-red"
	BgGreen   string = "bg-green"
	BgYellow  string = "bg-yellow"
	BgBlue    string = "bg-blue"
	BgMagenta string = "bg-magenta"
	BgCyan    string = "bg-cyan"
	BgWhite   string = "bg-white"

	BgBrightBlack   string = "bg-bright-black"
	BgBrightRed     string = "bg-bright-red"
	BgBrightGreen   string = "bg-bright-green"
	BgBrightYellow  string = "bg-bright-yellow"
	BgBrightBlue    string = "bg-bright-blue"
	BgBrightMagenta string = "bg-bright-magenta"
	BgBrightCyan    string = "bg-bright-cyan"
	BgBrightWhite   string = "bg-bright-white"

	Bold       string = "bold"
	Dim        string = "dim"
	Italic     string = "italic"
	Underlined string = "underlined"
	Blink      string = "blink"
	Inverse    string = "inverse"
)
View Source
var Carapace = struct {
	Value       string `desc:"default style for values"`
	Description string `desc:"default style for descriptions"`

	KeywordAmbiguous string `desc:"keyword describing a ambiguous state"`
	KeywordNegative  string `desc:"keyword describing a negative state"`
	KeywordPositive  string `desc:"keyword describing a positive state"`
	KeywordUnknown   string `desc:"keyword describing an unknown state"`

	LogLevelTrace    string `desc:"LogLevel TRACE"`
	LogLevelDebug    string `desc:"LogLevel DEBUG"`
	LogLevelInfo     string `desc:"LogLevel INFO"`
	LogLevelWarning  string `desc:"LogLevel WARNING"`
	LogLevelError    string `desc:"LogLevel ERROR"`
	LogLevelCritical string `desc:"LogLevel CRITICAL"`
	LogLevelFatal    string `desc:"LogLevel FATAL"`
}{
	Value:       Default,
	Description: Gray,

	KeywordAmbiguous: Yellow,
	KeywordNegative:  Red,
	KeywordPositive:  Green,
	KeywordUnknown:   Gray,

	LogLevelTrace:    Blue,
	LogLevelDebug:    Gray,
	LogLevelInfo:     Green,
	LogLevelWarning:  Yellow,
	LogLevelError:    Magenta,
	LogLevelCritical: Red,
	LogLevelFatal:    Cyan,
}

Functions

func ForKeyword added in v0.19.0

func ForKeyword(s string) string

ForKeyword returns the style for given keyword

func ForLogLevel added in v0.20.1

func ForLogLevel(s string) string

ForLogLevel returns the style for given log level

func ForPath

func ForPath(path string) string

ForPath returns the style for given path

/tmp/locally/reachable/file.txt

func ForPathExt added in v0.19.0

func ForPathExt(path string) string

ForPath returns the style for given path by extension only

/tmp/non/existing/file.txt

func Of added in v0.18.2

func Of(s ...string) string

Of combines different styles

func Register added in v0.19.0

func Register(name string, i interface{})

Register a style configuration

var Carapace = struct {
	Value       string `desc:"default style for values"`
	Description string `desc:"default style for descriptions"`
}{
	Value:       Default,
	Description: Gray,
}

func init() {
	Register("carapace", &Carapace)
}

func SGR added in v0.18.9

func SGR(s string) string

SGR returns the SGR sequence for given style

func Set added in v0.19.0

func Set(key, value string) error

Set a style

Set("carapace.Value", "bold magenta")

func TrueColor added in v0.18.9

func TrueColor(r, g, b uint8) string

TrueColor returns a 24-bit true color.

func XTerm256Color added in v0.18.9

func XTerm256Color(i uint8) string

XTerm256Color returns a color from the xterm 256-color palette.

Types

This section is empty.

Jump to

Keyboard shortcuts

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