renderer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package renderer provides SVG badge rendering with multiple style templates.

Index

Constants

View Source
const (
	ColorBrightgreen = Color("brightgreen")
	ColorGreen       = Color("green")
	ColorYellow      = Color("yellow")
	ColorYellowgreen = Color("yellowgreen")
	ColorOrange      = Color("orange")
	ColorRed         = Color("red")
	ColorBlue        = Color("blue")
	ColorGrey        = Color("grey")
	ColorGray        = Color("gray")
	ColorLightgrey   = Color("lightgrey")
	ColorLightgray   = Color("lightgray")
)

Standard colors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge struct {
	Subject string `json:"subject"`
	Status  string `json:"status"`
	Color   Color  `json:"color"`
	Style   Style  `json:"style"`
}

type Color

type Color string

Color represents color of the badge.

func (Color) IsValid

func (c Color) IsValid() bool

IsValid reports whether the color is a named scheme color or a hex code. Empty string is treated as valid to allow the template default.

func (Color) String

func (c Color) String() string

type Renderer

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

func NewRenderer

func NewRenderer(fontPath string) (*Renderer, error)

func NewRendererWithFontFace

func NewRendererWithFontFace(face font.Face) (*Renderer, error)

func (*Renderer) Render

func (r *Renderer) Render(b Badge) ([]byte, error)

type Style

type Style string
const (
	StyleFlat       Style = "flat"
	StyleFlatSquare Style = "flat-square"
	StylePlastic    Style = "plastic"
)

func (Style) IsValid

func (s Style) IsValid() bool

Jump to

Keyboard shortcuts

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