Documentation
¶
Overview ¶
Package render produces SVG button faces for Stream Deck keys.
Index ¶
- Constants
- func ContentFitTransform(d string, tx, ty, tw, th float64) string
- func FormatCountdown(seconds float64) string
- func IsValidHexColor(s string) bool
- func LightenHex(hex string, amount float64) string
- func RenderButton(in ButtonInput) string
- func RenderLoading(glyph *ProviderGlyph, fillColor, bgColor, fgColor string, showBorder *bool) string
- type BBox
- type ButtonInput
- type ProviderGlyph
Constants ¶
const Canvas = 144
Canvas is the edge length (in SVG user units) of a Stream Deck button face.
Variables ¶
This section is empty.
Functions ¶
func ContentFitTransform ¶
ContentFitTransform returns an SVG transform string that scales and centers a path's actual content into a target rectangle.
func FormatCountdown ¶
FormatCountdown formats seconds into a human-readable countdown.
func IsValidHexColor ¶
IsValidHexColor checks if a string is a valid hex color.
func LightenHex ¶
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.
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 — meter fill
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
// SmartContrast enables the dual-layer contrast auto-flip for text
// and the watermark glyph's back layer. The zero value (false)
// renders fg exactly as provided — callers opt in per-render.
// Application-level defaults live in GlobalSettings.SmartContrast
// (default on), and main.go threads that runtime decision into
// this field at each render site.
SmartContrast bool
}
ButtonInput configures a button face render.
type ProviderGlyph ¶
type ProviderGlyph struct {
// ViewBox is the SVG viewBox attribute for the glyph path.
ViewBox string
// D is the SVG path `d` attribute for the glyph geometry.
D string
// Stroke renders the glyph as an outline (stroke + fill:none +
// vector-effect:non-scaling-stroke) instead of the default filled
// silhouette — lets outline marks (Tabler, Lucide, etc.) sit
// alongside solid brand glyphs without reshaping each path to a
// closed fill region.
Stroke bool
}
ProviderGlyph holds an SVG path for a provider logo.