Documentation
¶
Index ¶
- Constants
- type Mixin
- type TerminalLevel
- type Tint
- func (t *Tint) Exp(expStr string) string
- func (t *Tint) Log(text string, colors ...color)
- func (t *Tint) Palette(mixins ...Mixin) string
- func (t *Tint) Print(text string, colors ...color)
- func (t *Tint) Println(text string, colors ...color)
- func (t *Tint) Raw(text string, colors ...color) string
- func (t *Tint) Swatch(colors ...color) func(text string)
- func (t *Tint) SwatchRaw(colors ...color) func(text string) string
- func (t *Tint) With(text string, colors ...color) Mixin
Constants ¶
View Source
const ( // Normal equates to no style Normal color = iota // Black color brackets in ansi format Black // Red color Red // Green color Green // Yellow color Yellow // Blue color Blue // Magenta color Magenta // Cyan color Cyan // White color White // BlackBright color BlackBright // RedBright color RedBright // GreenBright color GreenBright // YellowBright color YellowBright // BlueBright color BlueBright // MagentaBright color MagentaBright // CyanBright color CyanBright // WhiteBright color WhiteBright // BgBlack color BgBlack // BgRed color BgRed // BgGreen color BgGreen // BgYellow color BgYellow // BgBlue color BgBlue // BgMagenta color BgMagenta // BgCyan color BgCyan // BgWhite color BgWhite // Hyperlink text Hyperlink // Dim text Dim )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mixin ¶
type Mixin struct {
// contains filtered or unexported fields
}
Mixin helps bind a color to a specific text
type TerminalLevel ¶
type TerminalLevel int
TerminalLevel of color support for terminal and how does tint works with these levels
const ( // LevelNone for terminal that supports no colot LevelNone TerminalLevel = iota + 1 // Level16bit for terminal that supports 16bit colors Level16bit // Level256 for terminal that supports 256 bit colors Level256 // Level16m for terminal that supports 16 million colors (truecolor) Level16m )
type Tint ¶
type Tint struct {
Level TerminalLevel
SupportsColor bool
LogInstance *log.Logger
}
Tint struct holds the whole library
func Init ¶
func Init() *Tint
Init initializes variables that tint uses and then returns the pointer to a Tint struct
func (*Tint) Exp ¶
Exp returns a string constructed from a series of color expressions given as an argument
func (*Tint) Palette ¶
Palette lets you build a string with specific words with different background or foreground color of your choice NOTE: no need to specify space character at end of mixin
func (*Tint) Swatch ¶
Swatch helps you create your own function with spesified color Example:
green := tint.Swatch(tint.Green)
Click to show internal directories.
Click to hide internal directories.