badges

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgeConfig

type BadgeConfig struct {
	FontSize     float64           `help:"Font size of badges" default:"11"`
	XSpacing     int               `help:"X Spacing of Badge Elements" default:"8"`
	DefaultColor string            `help:"Default badge color" default:"4c1"`
	ColorList    map[string]string `` /* 190-byte string literal not displayed */
}

BadgeConfig provides configuration for a badge service.

type BadgeDesc

type BadgeDesc struct {
	Title string
	Text  string
	Color string
}

BadgeDesc is all the data to generate a badge.

type BadgeService

type BadgeService interface {
	CreateBadge(desc BadgeDesc) (string, error)
	Colors() []ColorMapping
}

BadgeService implements generating badge SVGs.

func NewBadgeService

func NewBadgeService(config *BadgeConfig) BadgeService

NewBadgeService initializes a new BadgeService interface.

type ColorMapping

type ColorMapping struct {
	Name  string
	Color string
}

ColorMapping provides structure for returning and sorting color mappings.

type FontCalculator

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

func NewFontCalculator

func NewFontCalculator(font *truetype.Font) *FontCalculator

func (*FontCalculator) TextWidth

func (fc *FontCalculator) TextWidth(fontSize float64, text string) (int, error)

Jump to

Keyboard shortcuts

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