tui/ansi.go
2024-07-25 13:36:42 -04:00

46 lines
1.1 KiB
Go

package tui
import "strings"
type Colors = string
type Fmt = string
// Formatting
const (
FmtReset Colors = "\033[0m"
FmtBold = "\033[1m"
FmtBoldReset = "\033[22m"
FmtDim = "\033[2m"
FmtDimReset = FmtBoldReset
FmtItalic = "\033[3m"
FmtItalicReset = "\033[23m"
FmtUnderline = "\033[4m"
FmtUnderlineReset = "\033[24m"
FmtBlink = "\033[5m"
FmtBlinkReset = "\033[25m"
FmtReverse = "\033[7m"
FmtReverseReset = "\033[27m"
FmtHidden = "\033[8m"
FmtHiddenReset = "\033[28m"
FmtStrikethrough = "\033[9m"
FmtStrikethroughReset = "\033[29m"
)
// Foreground Colors
const (
FgColorGrey Fmt = "\033[38;5;247m"
FgColorGold = "\033[28;5;214m"
FgColorGreen = "\033[38;5;34m"
FgColorRed = "\033[38;5;167m"
)
func Format(codes ...string) string {
var str strings.Builder
for _, code := range codes {
str.WriteString(code)
}
return str.String()
}