2024-07-07 20:41:35 +02:00
|
|
|
package tui
|
|
|
|
|
2024-07-07 21:39:09 +02:00
|
|
|
import "strings"
|
|
|
|
|
|
|
|
type Colors = string
|
|
|
|
type Fmt = string
|
|
|
|
|
2024-07-07 20:41:35 +02:00
|
|
|
// Formatting
|
|
|
|
const (
|
2024-07-07 21:39:09 +02:00
|
|
|
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"
|
2024-07-07 20:41:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Foreground Colors
|
|
|
|
const (
|
2024-07-07 21:39:09 +02:00
|
|
|
FgColorGrey Fmt = "\033[38;5;247m"
|
|
|
|
FgColorGold = "\033[28;5;214m"
|
|
|
|
FgColorGreen = "\033[38;5;34m"
|
|
|
|
FgColorRed = "\033[38;5;167m"
|
2024-07-07 20:41:35 +02:00
|
|
|
)
|
2024-07-07 21:39:09 +02:00
|
|
|
|
|
|
|
func Format(codes ...string) string {
|
|
|
|
|
|
|
|
var str strings.Builder
|
|
|
|
|
|
|
|
for _, code := range codes {
|
2024-07-25 19:36:42 +02:00
|
|
|
str.WriteString(code)
|
2024-07-07 21:39:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return str.String()
|
|
|
|
}
|