Documentation
¶
Overview ¶
Package fresco is a generative terminal field engine: it renders a slow-drifting, palette-coloured pattern that appears to emanate from a focal row. It is a self-contained engine — the field math, the gradient LUT, and the variant vocabulary — that the caller drives through Render. The caller owns any scene composition (an overlay/message on top) and variant selection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render builds the colored splash field background: exactly h rows of exactly w visible cells, or "" on a degenerate pane. Pure over its inputs (deterministic, snapshot-testable). It resolves the focal row and the per-variant Pass-2 policy (applying Options.LumRange over the variant default) and hands off to renderField.
Types ¶
type Options ¶
type Options struct {
// Palette supplies the four warm→cool gradient anchors plus the star /
// rain-head highlight.
Palette Palette
// Variant selects the field generator.
Variant Variant
// FocalRow is the pane row the pattern emanates from — the origin of the
// focal-relative coordinates every field is evaluated in. A negative value
// centres it on the pane.
FocalRow int
// LumRange, when non-nil, overrides the variant's shipped luminance-range
// policy (the split between glyph density and colour luminance); nil keeps
// the variant's default. It is how a caller applies a luminance-range
// override without this package reading the environment.
LumRange *float64
// Profile, when non-nil, pins the color depth Render emits at (truecolor,
// 256, 16, or none), independent of the process-global color profile. nil
// defers to lipgloss.ColorProfile() — the auto-detected terminal profile —
// which is what a caller wants when rendering to a real pane. Setting it
// makes Render pure over its inputs: the same Options yield the same bytes
// regardless of ambient stdout state, which is what a standalone consumer
// (and a snapshot test) needs.
Profile *termenv.Profile
}
Options configures Render.
type Palette ¶
Palette is the splash field's colour input: four warm→cool gradient anchors plus a highlight, each an "#rrggbb" hex string. A0..A3 are the nebula gradient (e.g. pink, purple, blue, cyan); consecutive anchors are meant to be hue-adjacent so HCL blending between them stays smooth. A3 doubles as rain's stream hue. Highlight is the star / rain-head white — the brightest colour the field can reach (the foreground / near-white). An anchor that is not parseable hex degrades gracefully (see splashGradientColors, splashShadeParse).
type Variant ¶
type Variant int
Variant selects the field generator + glyph technique. The caller pins one (or keeps a random per-launch rotation) and passes it in through Options; a caller-side override affordance can trump that.
const ( // Rain ("f") is Matrix-style digital rain: per-column streams with bright // heads and fading tails, layered at three depths. The roster's motion entry // — and the only variant that shades by luminance alone, with no hue of its // own to spend (see buildRainRamp). // // It is also the fallback: a variant with no case in splashFieldAt or ops // renders as rain, and a caller resolves an unrecognized override name to // it too. Rain Variant = iota // Tunnel ("g") is a textured wall flying past a vanishing point that sits on // the focal point: screen position maps to (depth, angle), so a plain noise // lookup becomes an infinite corridor. The roster's depth entry — z-fog // carries distance in luminance, and hue bands by depth into coloured rings // receding down the wall. Tunnel // Ripple ("h") is drops falling on a dark pool: each one flashes where it // lands and expands into a ring that shifts hue as it ages, and the rings // interfere where they cross. The roster's event entry — the only field with // a birth and a death in it rather than a steady state. Ripple // Galaxy ("i") is an inclined spiral turning around the focal point: a soft // bright bulge, arms mottled with turbulence and star-knots, a dust lane // silhouetting the disk's near edge, warm at the core and cool at the rim. The // tunnel's single-object sibling — brightness is the whole subject, and the // arms are a rigidly rotating density wave rather than winding matter (see // splashGalaxyAtFor). Galaxy )
func ParseVariant ¶
ParseVariant resolves a pinnable pattern name to its variant. It knows only the user-facing names, not the dev letters (f/g/h) — those are a caller-side affordance layered on top. The bool is false for an unknown name.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
fresco-demo
command
Command fresco-demo animates the fresco fields in your terminal.
|
Command fresco-demo animates the fresco fields in your terminal. |