2024-07-07 19:41:35 +01:00
|
|
|
package tui
|
|
|
|
|
2024-07-07 20:39:09 +01:00
|
|
|
import "strings"
|
|
|
|
|
|
|
|
type Colors = string
|
|
|
|
type Fmt = string
|
|
|
|
|
2024-07-07 19:41:35 +01:00
|
|
|
// Formatting
|
|
|
|
const (
|
2024-07-07 20:39:09 +01: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 19:41:35 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Foreground Colors
|
|
|
|
const (
|
2024-07-07 20:39:09 +01: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 19:41:35 +01:00
|
|
|
)
|
2024-07-07 20:39:09 +01:00
|
|
|
|
|
|
|
func Format(codes ...string) string {
|
|
|
|
|
|
|
|
var str strings.Builder
|
|
|
|
|
|
|
|
for _, code := range codes {
|
2024-07-25 18:36:42 +01:00
|
|
|
str.WriteString(code)
|
2024-07-07 20:39:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return str.String()
|
|
|
|
}
|