render

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package render produces SVG button faces for Stream Deck keys.

Index

Constants

View Source
const Canvas = 144

Variables

This section is empty.

Functions

func ContentFitTransform

func ContentFitTransform(d string, tx, ty, tw, th float64) string

ContentFitTransform returns an SVG transform string that scales and centers a path's actual content into a target rectangle.

func FormatCountdown

func FormatCountdown(seconds float64) string

FormatCountdown formats seconds into a human-readable countdown.

func IsValidHexColor

func IsValidHexColor(s string) bool

IsValidHexColor checks if a string is a valid hex color.

func LightenHex

func LightenHex(hex string, amount float64) string

LightenHex blends a hex color toward white by amount (0..1).

func RenderButton

func RenderButton(in ButtonInput) string

RenderButton produces an SVG string for a Stream Deck key face.

func RenderLoading

func RenderLoading(glyph *ProviderGlyph, fillColor, bgColor, fgColor string, showBorder *bool) string

RenderLoading produces a loading face with just the provider glyph.

Types

type BBox

type BBox struct {
	MinX, MinY, MaxX, MaxY float64
}

BBox is an axis-aligned bounding box.

func PathBBox

func PathBBox(d string) BBox

PathBBox computes the approximate bounding box of an SVG path's d attribute. Includes bezier control points (conservative estimate).

func (BBox) Height

func (b BBox) Height() float64

Height returns the bounding box height.

func (BBox) Width

func (b BBox) Width() float64

Width returns the bounding box width.

type ButtonInput

type ButtonInput struct {
	Label        string
	Value        string
	Subvalue     string
	Ratio        *float64 // nil = reference card
	Direction    string   // "up"|"down"|"right"|"left"
	Fill         string   // hex
	Bg           string   // hex
	Fg           string   // hex
	Border       *bool    // nil = true
	ValueSize    string   // "small"|"medium"|"large"
	SubvalueSize string
	Stale        *bool
	Glyph        *ProviderGlyph
	GlyphMode    string // "watermark"|"centered"|"corner"|"none"
	ShowGlyph    *bool  // nil = true
}

ButtonInput configures a button face render.

type ProviderGlyph

type ProviderGlyph struct {
	ViewBox string
	D       string
}

ProviderGlyph holds an SVG path for a provider logo.

Jump to

Keyboard shortcuts

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