badge

package
v1.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StyleFlat       = "flat"
	StyleFlatSquare = "flat-square"
)

Style follows https://shields.io/badges

View Source
const (
	DefaultColor      = "#9f9f9f" // Grey
	DefaultFontFamily = "DejaVu Sans,Verdana,Geneva,sans-serif"
	DefaultStyle      = StyleFlat
)

Variables

View Source
var GlobalVars = sync.OnceValue(func() (ret struct {
	StatusColorMap       map[actions_model.Status]string
	DejaVuGlyphWidthData map[rune]uint8
	AllStyles            []string
},
) {
	ret.StatusColorMap = map[actions_model.Status]string{
		actions_model.StatusSuccess:   "#4c1",
		actions_model.StatusSkipped:   "#dfb317",
		actions_model.StatusUnknown:   "#97ca00",
		actions_model.StatusFailure:   "#e05d44",
		actions_model.StatusCancelled: "#fe7d37",
		actions_model.StatusWaiting:   "#dfb317",
		actions_model.StatusRunning:   "#dfb317",
		actions_model.StatusBlocked:   "#dfb317",
	}
	ret.DejaVuGlyphWidthData = dejaVuGlyphWidthDataFunc()
	ret.AllStyles = []string{StyleFlat, StyleFlatSquare}
	return ret
})

Functions

This section is empty.

Types

type Badge

type Badge struct {
	IDPrefix   string
	FontFamily string
	Color      string
	FontSize   int
	Label      Text
	Message    Text
}

func GenerateBadge

func GenerateBadge(label, message, color string) Badge

GenerateBadge generates badge with given template

func (Badge) Width

func (b Badge) Width() int

type Text added in v1.24.0

type Text struct {
	// contains filtered or unexported fields
}

func (Text) Text added in v1.24.0

func (t Text) Text() string

func (Text) TextLength added in v1.24.0

func (t Text) TextLength() int

func (Text) Width added in v1.24.0

func (t Text) Width() int

func (Text) X added in v1.24.0

func (t Text) X() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL