Documentation
¶
Overview ¶
Package borealis is THE pleme-io terminal design system: one Theme token bundle, one render verb, and one producer per charm-stack themeable surface.
It is the canonical fleet-wide entrypoint named in BOREALIS §2.9 / §3.5. The resolved token bundle has exactly one type name fleet-wide — Theme — and everything user-facing across the *-go family is rendered through the single verb Render. The brand name is literal and load-bearing: borealis (aurora borealis) IS the Nord Aurora family (see package theme), so the brand, the palette, and the design system are one idea.
Architecture (BOREALIS Law 8 — no core↔core cycle; Law 6 — weight is import-gated):
- The CORE (this package + theme + comp + style) is built on the stable lipgloss v1 surface and carries no heavy charm-stack deps. It is the surface already consumed by shikumi-go/diag and logging-go/console (comp.StatusList / comp.KV / comp.Glyph / comp.Table), so it stays offline-buildable and back-compatible.
- The three charm-stack themeable surfaces live in GATED LEAF sub-packages that import the v2 stack: fangx (CLI help/errors via fang+cobra), huhx (huh forms), bubblesx (bubbles widgets). Each takes a borealis.Theme and produces that framework's theme struct from the same Nord tokens.
Uniformity contract (the trivial-tooling payoff, BOREALIS §4):
t, _ := borealis.FromConfig(cfg.Borealis) // resolve the token bundle fmt.Println(borealis.Render(t, status)) // the one render verb return borealis.Execute(ctx, root) // styled CLI (cli-go root in)
Index ¶
- Constants
- func ColorScheme(t Theme) fang.ColorSchemeFunc
- func Execute(ctx context.Context, root *cli.App, opts ...fang.Option) error
- func Render[T any](t Theme, x T) string
- func RunCobra(ctx context.Context, root *cobra.Command, t Theme, opts ...fang.Option) error
- type ColorMode
- type Config
- type Mode
- type Renderable
- type Role
- type Theme
Constants ¶
const ( Neutral = theme.Neutral Active = theme.Active Info = theme.Info Success = theme.Success Warning = theme.Warning Danger = theme.Danger )
Semantic roles, re-exported from package theme for a single import surface.
Variables ¶
This section is empty.
Functions ¶
func ColorScheme ¶
func ColorScheme(t Theme) fang.ColorSchemeFunc
ColorScheme maps a Theme onto fang's semantic colour slots, returning a fang.ColorSchemeFunc (the shape WithColorSchemeFunc wants). Every CLI's help/usage/errors is therefore themed from the same Nord tokens as the rest of the design system — closing the headline auto-help loop (BOREALIS §2.9).
It lives in the borealis CORE (not the fangx leaf) so that Execute can wire fang without importing fangx — fangx imports borealis for the Theme, so a core→fangx import would form a cycle (Law 8). The fangx leaf re-exports this for back-compatible callers.
func Execute ¶
Execute is the canonical CLI entrypoint named in BOREALIS §3.5 (`borealis.Execute(ctx, root, opts…) error`). It is the OUTERMOST entrypoint for every fleet CLI: cli-go's typed root *cli.App is PASSED to it, never redeclared. A service is just a CLI whose `serve` subcommand's Run calls lifecycle.New(...).Run(ctx); borealis.Execute is always the outermost shell.
It realises the grammar/presentation split (§2.2): cli-go owns the typed grammar (the single source of truth — one tree that derives parse, validation, and help structure), and borealis owns 100% of presentation. Execute lowers the typed cli-go tree onto a cobra command via the cli-go/cobrax leaf (Law 8: the lowering lives in cli-go, not here), then runs it under the borealis-themed fang decorator with the Nord ColorScheme pinned. The result:
return borealis.Execute(ctx, root) // styled help/errors/version, Nord
is the entire CLI entrypoint — no hand-rolled argv switch, no monochrome help, no per-tool styling.
The theme is Nord (the borealis brand palette). opts are forwarded to fang for per-tool extras (extra version info, man metadata, custom completions); the ColorScheme is always pinned first so a tool cannot accidentally un-theme the fleet surface.
func Render ¶
Render is THE one render verb (BOREALIS §3.5). Every user-facing value in the fleet — errors-go, todoku-go, lifecycle-go, shigoto-go, cli-go help prose — is rendered through this single function, so two fleet tools cannot drift in how their output looks. Classifiers/producers (Explain, Status, Report) emit a typed value; that value is rendered here. There is no RenderReceipt / StatusString / free-function-with-theme variant.
Render dispatches over the canonical renderable kinds:
- a Renderable renders itself;
- the comp typed values (comp.StatusList-shaped slices, comp.Table, comp.KV) render via the comp package;
- a comp.Tabler renders as a borealis table;
- a plain string passes through (already-rendered);
- anything else falls back to a muted fmt rendering so Render is total.
func RunCobra ¶
RunCobra is the exported funnel the fangx leaf re-exports as fangx.Execute: it runs an already-lowered *cobra.Command under the borealis-themed fang decorator. Tools that hold a typed cli-go root should call Execute instead (it lowers for you); this entry exists for callers that already have a cobra command (and for the fangx leaf's back-compatible surface).
Types ¶
type ColorMode ¶
type ColorMode string
ColorMode controls colour output. Auto downsamples to the detected terminal profile; Always forces colour; Never disables it (honouring NO_COLOR).
type Config ¶
type Config struct {
// Theme overrides individual tokens. A zero Theme means "use the brand
// default" (Nord). Any non-empty field overrides the corresponding token.
Theme theme.Theme `json:"theme" yaml:"theme"`
// Mode selects light/dark adaptation. Default ModeAuto.
Mode Mode `json:"mode" yaml:"mode"`
// Color controls colour output. Default ColorAuto. NO_COLOR in the
// environment forces ColorNever regardless of this value (§8 item 8).
Color ColorMode `json:"color" yaml:"color"`
// Accessible passes huh's accessible mode through and biases components
// toward high-contrast, no-colour-dependent output.
Accessible bool `json:"accessible" yaml:"accessible"`
}
Config is the shikumi-loadable runtime knob surface for the design system (BOREALIS §2.9 / elevation §8 item 7). It is a typed struct with yaml tags; it is loaded ONCE at main via shikumi (see github.com/pleme-io/borealis/cfg) and the already-loaded sub-struct is handed to FromConfig — which never itself calls shikumi.Load (BOREALIS §3.5).
Theme is an embedded, fully-overridable token bundle: leaving it zero selects the Nord brand default; a yaml file may override any token (pure data), which is the consume-an-upstream-generated-theme seam for Law 4.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the brand defaults: Nord theme, auto mode, auto colour.
type Mode ¶
type Mode string
Mode selects light/dark adaptation. Auto defers to terminal background detection (done by the v2 writers in the gated leaves); Light/Dark force it.
type Renderable ¶
Renderable is any typed value that knows how to render itself through a Theme. Domain values that already produce a string from a theme (the comp set, classifier outputs like todoku's Explain or lifecycle's Status) implement this so Render dispatches uniformly. This is the carrier interface behind the one render verb (BOREALIS Law 5).
type Role ¶
Role is a semantic intent re-exported so consumers can stay inside the borealis package surface (borealis.Success, borealis.Danger, …).
type Theme ¶
Theme is the resolved design-token bundle — THE single type name fleet-wide (BOREALIS §3.5: "the resolved theme token bundle has exactly one type name fleet-wide: borealis.Theme"). It is an alias of theme.Theme so the canonical name and the back-compat package surface are byte-identical: a sibling that already takes a theme.Theme (shikumi-go/diag, logging-go/console) is automatically passing a borealis.Theme.
func Default ¶
func Default() Theme
Default returns the borealis brand theme (the Nord aurora palette).
func FromConfig ¶
FromConfig resolves a Config into the canonical Theme token bundle (BOREALIS §3.5: `pkg.FromConfig(cfg pkg.Config) (*T, error)` shape — here T is the value type Theme since the bundle is pure data). It takes the already-loaded sub-struct and MUST NOT call shikumi.Load.
Resolution: start from the Nord brand default, then overlay any non-zero token from cfg.Theme. NO_COLOR (or Color==Never) is recorded by the gated leaves at render time via Config.NoColor; FromConfig itself stays pure so it is total and deterministic.
func Nord ¶
func Nord() Theme
Nord returns the borealis brand theme built from the hardcoded Nord palette. It is the single source of truth every producer derives from.
func Tundra ¶
func Tundra() Theme
Tundra returns the borealis "tundra" theme: the Nord aurora idea in a cooler, deeper, higher-contrast arctic palette variant. It binds the same semantic roles as Nord, so any consumer written against a Theme renders unchanged. Tundra is a NEUTRAL palette — it carries no downstream brand name; a profile that selects it owns the brand and keeps it out of borealis (WORLDS-SEPARATE, see theory/borealis-profiles.md).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bubblesx is the GATED LEAF that themes the stock-widgets surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9).
|
Package bubblesx is the GATED LEAF that themes the stock-widgets surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9). |
|
Package cfg is the GATED LEAF that loads a borealis.Config through shikumi-go (BOREALIS Law 3 / Law 8).
|
Package cfg is the GATED LEAF that loads a borealis.Config through shikumi-go (BOREALIS Law 3 / Law 8). |
|
Package comp provides themed, render-to-string terminal components built on a theme.Theme.
|
Package comp provides themed, render-to-string terminal components built on a theme.Theme. |
|
Package fangx is the GATED LEAF that themes the CLI help/usage/errors surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9).
|
Package fangx is the GATED LEAF that themes the CLI help/usage/errors surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9). |
|
Package huhx is the GATED LEAF that themes the interactive-forms surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9).
|
Package huhx is the GATED LEAF that themes the interactive-forms surface — one of the exactly-three themeable surfaces of a charm-stack tool (BOREALIS §2.9). |
|
Package style turns a theme.Theme into a ready-to-use set of Lip Gloss styles.
|
Package style turns a theme.Theme into a ready-to-use set of Lip Gloss styles. |
|
Package svg is the GATED LEAF that renders a typed borealis diagram model to an ishou-themed SVG document or a mermaid source string — the two document-render targets named in the pattern registry §4d (borealis row: "ishou-themed SVG/mermaid render helper").
|
Package svg is the GATED LEAF that renders a typed borealis diagram model to an ishou-themed SVG document or a mermaid source string — the two document-render targets named in the pattern registry §4d (borealis row: "ishou-themed SVG/mermaid render helper"). |
|
Package theme defines borealis's design tokens: a small set of semantic colours that everything else derives from.
|
Package theme defines borealis's design tokens: a small set of semantic colours that everything else derives from. |
|
Package tui is the GATED LEAF of borealis tea.Model components — live, interactive widgets that carry an injected borealis.Theme so a TUI is themed from the same Nord tokens as static render output (elevation §8 item 10).
|
Package tui is the GATED LEAF of borealis tea.Model components — live, interactive widgets that carry an injected borealis.Theme so a TUI is themed from the same Nord tokens as static render output (elevation §8 item 10). |