tempera: github.com/ShogunPanda/tempera Index | Files

package tempera

import "github.com/ShogunPanda/tempera"

Index

Package Files

codes.go custom.go main.go template.go

Variables

var ANSIBackgroundCodes = ANSICode{48, 49}

ANSIBackgroundCodes holds general code for foreground color management

var ANSICodes = map[string]ANSICode{
    "reset": {0, 0},

    "bold":          {1, 22},
    "dim":           {2, 22},
    "italic":        {3, 23},
    "underline":     {4, 24},
    "inverse":       {7, 27},
    "hidden":        {8, 28},
    "strikethrough": {9, 29},

    "black":   {30, 39},
    "red":     {31, 39},
    "green":   {32, 39},
    "yellow":  {33, 39},
    "blue":    {34, 39},
    "magenta": {35, 39},
    "cyan":    {36, 39},
    "white":   {37, 39},
    "gray":    {90, 39},

    "bgBlack":   {40, 49},
    "bgRed":     {41, 49},
    "bgGreen":   {42, 49},
    "bgYellow":  {43, 49},
    "bgBlue":    {44, 49},
    "bgMagenta": {45, 49},
    "bgCyan":    {46, 49},
    "bgWhite":   {47, 49},

    "redBright":     {91, 39},
    "greenBright":   {92, 39},
    "yellowBright":  {93, 39},
    "blueBright":    {94, 39},
    "magentaBright": {95, 39},
    "cyanBright":    {96, 39},
    "whiteBright":   {97, 39},

    "bgBlackBright":   {100, 49},
    "bgRedBright":     {101, 49},
    "bgGreenBright":   {102, 49},
    "bgYellowBright":  {103, 49},
    "bgBlueBright":    {104, 49},
    "bgMagentaBright": {105, 49},
    "bgCyanBright":    {106, 49},
    "bgWhiteBright":   {107, 49},
}

ANSICodes is the list of ANSI Escape codes, taken from https://github.com/chalk/ansi-styles

var ANSIForegroundCodes = ANSICode{38, 39}

ANSIForegroundCodes holds general code for foreground color management

func AddCustomStyle Uses

func AddCustomStyle(name string, styles ...string) error

AddCustomStyle add a new custom style

func CleanTemplate Uses

func CleanTemplate(template string) string

CleanTemplate removes all style tag from a template

func Colorize Uses

func Colorize(content string, styles ...string) string

Colorize add colors to a string using a specific list of styles, in order

func ColorizeTemplate Uses

func ColorizeTemplate(template string) string

ColorizeTemplate add colors to a template string

func DeleteCustomStyles Uses

func DeleteCustomStyles(names ...string)

DeleteCustomStyles removes one or more custom styles

type ANSICode Uses

type ANSICode struct {
    Open  int
    Close int
}

ANSICode represents a ANSI code with opening and closing (resetting) code

Package tempera imports 6 packages (graph). Updated 2018-04-23. Refresh now. Tools for package owners.