summaryrefslogtreecommitdiff
path: root/internal/colour/colour.go
blob: 374a5b49427c262b71a06ae8dda973c29151872e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package colour

import (
	"fmt"

	"github.com/fatih/color"
)

var (
	Infofln = func(format string, args ...any) {
		fmt.Printf(format, args...)
		fmt.Print("\n")
	}
	Infoln = func(args ...any) { fmt.Println(args...) }

	AttentionCol = color.New(color.FgHiYellow, color.BgBlue)
	warnCol      = color.New(color.FgHiWhite, color.BgRed)
	Warnln       = warnCol.PrintlnFunc()

	errorCol = color.New(color.FgRed)
	Errorln  = errorCol.PrintlnFunc()

	successCol = color.New(color.FgWhite, color.BgGreen)
	Successfln = func(format string, args ...any) {
		if _, err := successCol.Printf(format, args...); err != nil {
			// Log the error but don't fail the operation since we've already printed the data
			Errorln("Error printing success message:", err)
		}
		fmt.Print("\n")

	}

	AckCol = color.New(color.FgBlack, color.BgHiYellow, color.Bold)
	Ackf   = AckCol.PrintfFunc()
)