Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Concept

Goldberry draws every pixel itself, describes a screen as data, and keeps the native code behind one boundary. This page is the idea in five parts and what each one buys.

One rendering pipeline, everywhere

Goldberry does not wrap the platform’s widgets and does not embed a browser. A button on Linux, Windows and macOS is the same button: the same CSS rule, the same Yoga layout, the same Blend2D rasterization, the same HarfBuzz-shaped text in the same embedded fonts. The platform supplies a window, input events, the clipboard and a surface to present into, through SDL3. Everything above that line is Java and runs identically on every desktop.

The result is deterministic. A frame is the same bytes on every machine, so an application can test itself with golden images.

A screen is a description

A widget is an immutable Java record with a pure build(). The toolkit calls build(), diffs the result against the element tree it kept from the last frame, and updates only what changed. State that must survive a rebuild, a hover or a caret, lives on the element rather than on the widget.

The same tree can be written as KDL markup, and every built-in widget exists three ways: a record, a node name and a CSS type.

row id="confirm" {
  spacer
  button press="dismiss" "Cancel"
  button class="danger" press="delete" "Delete"
}
new Row(
        new Spacer(),
        new Button("Cancel", this::dismiss),
        new Button("Delete", this::delete).styled("danger")
)

Markup names things and never contains code. A press= names an action, a bind= names a value, an icon= names an icon. Each resolves against a registry the application supplied, and a name that resolves to nothing fails when the document is inflated rather than when the user clicks.

Data flows down, events flow up

A control never owns its value. It is handed an Observable and draws what it reads. When the user acts, the control raises an action, the application’s handler assigns a field, and the new value flows back down. A checkbox whose tick will not move is a handler that did not change the state, which is where the bug is.

The model is plain Java: a class of fields marked @Bind, and methods marked @Action. On the JVM the toolkit binds them reflectively at run time. For a native image a build step rewrites the compiled class so that every assignment notifies directly, with no reflection anywhere. Ahead-of-time binding is the whole story.

Real CSS, real flexbox

Styling is a genuine subset of CSS: selectors, the cascade in layers, custom properties, inheritance, transitions on a frame clock, transforms and opacity. Layout is flexbox, through Yoga bound directly rather than reimplemented.

Every colour a control uses is a --gb-* token, so switching from the Nord dark theme to the Nord light one restyles every control though no rule names a colour. Density is three tokens on :root. Markup and stylesheets hot-reload while the application runs (Styling).

Light to ship

The core runtime uses SLF4J for logging and FFM for native calls. The desktop library ships as a classifier jar per target. Optional media and SVG modules have their own native libraries, and the spelling provider uses Lucene.

An application runs on a JDK 25 or newer, or compiles with GraalVM into an executable that carries its native libraries. Native image

What it is built on

LibraryRoleWhere it lives
Blend2D2D rasterization, with its PNG, JPEG and QOI codecsinside libgoldberry
Yogaflexbox layoutinside libgoldberry
HarfBuzztext shapinginside libgoldberry
SDL3windows, input, clipboard, popups, tray, SDL_GPUinside libgoldberry
md4cMarkdown parsinginside libgoldberry
libwebpWebP decodinginside libgoldberry
dav1d, libvpx, Opus, Vorbis, FLAC, minimp3, Theora and libyuvaudio and video decoding and conversiongoldberry-media, in one libgoldberry-media
ThorVGSVG rasterizationgoldberry-vector, in libgoldberry-vector
Lucene Hunspellspelling dictionariesoptional goldberry-spell
Inter, JetBrains Monothe UI and code typefacesinside goldberry-core
Lucide1,870 icons as path datainside goldberry-core
Noto Color Emojithe emoji facegoldberry-emoji

Everything in the table is open source, and the licences travel inside every jar under META-INF/.