render

package
v10.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package render resolves options against a style and turns the element tree into the final SVG. It bundles the option resolver, the renderer, and the metadata/escaping helpers; Generate is the single entry point the public Avatar uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	SVG     string
	Options map[string]any
	Order   []string
}

Result is the outcome of rendering an avatar: the SVG, the resolved-options snapshot, and the order its keys were resolved in (for the JSON envelope).

func Generate

func Generate(s *style.Style, opts map[string]any) (*Result, error)

Generate validates options, resolves them against the style, and renders the SVG. A nil options map is treated as empty. Returns an error on invalid options or a circular color reference.

Options are normalized through a JSON round-trip, so passing a Go int such as map[string]any{"size": 128} behaves the same as the JSON 128.

Jump to

Keyboard shortcuts

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