Skip to main content

Crate fenestra

Crate fenestra 

Source
Expand description

fenestra: a pure-Rust native GUI framework with web-grade aesthetics.

Re-exports the core IR and theme, the widget kit, and the windowed and headless runners. Start with App, run, and the prelude.

Re-exports§

pub use fenestra_kit as kit;
pub use fenestra_shell as shell;

Modules§

by
Query constructors, in the order you should prefer them.
canvas
The canvas substrate: camera, zoom, snapping, and zoom-compensated stroke math for pan/zoom canvases (Figma/tldraw-class tools). Pure geometry — no rendering, no state — so it composes with the element tree and runs headless. Constants follow tldraw’s defaults.
effects
Generated effect fields: deterministic RGBA8 textures for the “bespoke” end of the design system. The inputs (size, color points, seed, intensity) tokenize; the output is a pixel buffer you hand to image_rgba8. Pure and deterministic, so these golden-lock like everything else in fenestra.
optical
Optical adjustments: the small geometric corrections that make shapes look right even though they measure “wrong”. The eye weighs the area near a shape’s boundary, so a circle must be slightly larger than a square to read as the same size, and an asymmetric shape (a play triangle) must be centered on its visual mass (centroid), not its bounding box. (bjango optical adjustments; Rauno’s interface guidelines.)
prelude
Commonly used items: builders, tokens, widgets, and the runner.

Structs§

AccessNode
One node of a frame’s accessibility projection (see Frame::access_tree): plain data, usable headlessly in tests and mapped to AccessKit by the windowed shell.
AdaptiveTint
Backdrop-adaptive vibrancy for a glass material. In the headless two-pass renderer — where the frosted backdrop image is in hand at paint time — the painter measures the mean luminance of the blurred crop behind the pane and shifts the tint’s OKLCH lightness toward white over dark backdrops and toward black over light ones, so the frosted surface keeps a stable contrast against whatever floats behind it. This is Fluent Acrylic’s “luminosity clamp” idea reduced to a single mean-luminance lightness shift (Apple Liquid Glass does the same tonal adaptation, without a published formula). None (the default) keeps a fixed tint, so non-glass elements — and the single-pass live window, which has no backdrop image — stay byte-identical. Set by Surface::Glass.
BaseField
The neutral-field character for Theme::derive: the hue the neutral ramp is tinted with and how far it departs from gray. chroma multiplies the neutral table’s (very low) base chroma — 1.0 is the stock near-gray SaaS tint, 410 an atmospheric duotone field (deep green, warm paper), 0 pure gray.
Border
A border stroke: a width and color. Apply it to every edge with Style::border, or to a single edge with Style::border_top and friends (carried per-edge by EdgeBorders).
Breakpoints
Yes/no width queries against the Breakpoint thresholds — the boolean counterpart of Breakpoint::at, for view_at / responsive consumers that want a flag rather than a band. A zero-sized namespace, never constructed.
Catalog
A message catalog: keys mapped to translated strings with {name} placeholder interpolation. A missing key falls back to the key itself, so a view never renders blank.
ContrastViolation
A text/background pair that failed its APCA Lc floor during Theme::validate_contrast.
CornerRadius
Per-corner radii in logical pixels.
CubicBezier
A cubic bezier easing curve (x1, y1, x2, y2), CSS-style: x1/x2 are clamped to 0..=1 by convention (a monotone x-curve) but y1/y2 may leave that range for an overshoot curve.
DeriveSpec
The three-input parameters of a ThemeSpec (Theme::derive).
Dispatch
The result of dispatching one event.
DuotoneSpec
The duotone parameters of a ThemeSpec.
EdgeBorders
Per-edge border strokes (top/right/bottom/left), each optional and independent of the uniform Border. Drawn as straight hairlines with square corners — for a rounded full edge use Style::border. Lets hairline-divided layouts (a header’s bottom rule, a left accent rail, a table’s ruled rows) skip manual 1px divider children.
Edges
Per-edge values (padding, margin, inset).
Element
One node in the view tree. Msg is the app’s message type; handlers carry Msg values, not closures over state.
ExitAnim
How an element animates out when it leaves the tree (the counterpart of Element::enter). When an element tagged with Element::exit is removed, a paint-only snapshot (“ghost”) is left in its place and animates toward these targets over transition, then is dropped — there is no live widget behind it (inputs collapse to a plain box). Inert under reduced motion: the element is removed immediately, so headless renders are unchanged.
FocusRing
The focus-ring spec (shadcn v4 model). On keyboard focus a control swaps its border to the ring color and draws a soft halo width px wide at alpha, offset px outside the border (0 = flush). The ring color is the accent by default and the danger hue when the control is marked invalid. Painted only when focus arrived via keyboard (crate’s focus_visible).
FontFeatures
A typed set of OpenType features applied to a text run. Orthogonal axes: figure shape (figures) and figure spacing (spacing) compose freely (e.g. tabular + old-style is valid), small caps, standard ligatures, and fractions are independent toggles. The default enables nothing, leaving every glyph at the font’s own defaults. Built into a CSS font-feature-settings string for parley; part of the layout cache key.
Fonts
The font system: a fontique collection with the embedded Inter family, parley contexts, and the layout cache. One per app (or per test process).
Frame
A laid-out frame: resolved styles and absolute rects for every element. Paint, input routing, and debug dumps all read from this one structure.
FrameState
Retained state for one UI surface (window or headless session).
FromIter
Marker for the iterator family (see IntoChildren).
FromTuple
Marker for the tuple family (see IntoChildren).
GradientStop
A gradient color stop: offset 0.0..=1.0 and a color.
GridLines
A named-line placement on one grid axis: the start and end line names (CSS grid-column: a / b). Empty by default — numeric/auto placement. Names resolve against the parent grid’s grid-template-areas (<name>-start / <name>-end) and explicit line names.
GridPlace
Grid item placement on one axis.
ImageData
Payload for Kind::Image.
InputData
Payload for Kind::Input.
Inset
Optional per-edge offsets for positioned elements.
KeyInput
A key press with modifiers.
Keyframes
A looping keyframe timeline: style stops at fractional times across one period, sampled from the frame clock every frame. Built for ambient motion (pulses, shimmers, breathing); one-shot state changes belong to Transition. With reduced motion the first stop is pinned, keeping headless renders deterministic.
Locale
A locale: a BCP-47-ish language tag plus the writing direction and the decimal / grouping separators used to format numbers. Construct with Locale::new (which infers everything from the tag) or tune the separators with the builders.
Material
A translucent “frosted glass” material (Apple “materials” / Linear & Raycast command palettes): a pane that reads as floating glass over the content behind it. Describes the three perceptual levers of glass — how much shows through (fill_alpha), how strongly the content behind would be blurred (blur_radius), and how much the wash-out is re-saturated (saturation, “vibrancy”). Resolved against a Theme (never a raw color) by Material::tint, and carried by a SurfaceBundle via the Surface::Glass role.
MemoryClipboard
The default in-memory clipboard (headless tests use this).
MultiPassSpec
One region the shell must filter out-of-band, recorded during the backdrop walk and keyed back to its element by id.
Nav
A non-empty stack of routes. The bottom entry is the root and is never popped, so current is always valid — Nav cannot be empty.
OpticalCorrection
Optical corrections for a Kind::Path (see crate::optical): geometric nudges that make a shape look right even though it measures “wrong”. Both default to off, so a path renders byte-identically until opted in — set them per icon where the shape needs it, rather than auto-detecting (which would silently shift every existing icon).
Overlay
Marks an element as an overlay child of its parent (the anchor): excluded from normal layout, laid out against the canvas, painted after the root, and hit-tested first.
PathData
Path payload for Kind::Path.
Proxy
Delivers messages into the running app’s update from any thread: background work, timers, IO completion. Cloneable and cheap; apps receive one in crate::App::init and move clones into threads.
Query
A semantic query against the frame’s accessibility tree. Build one with the by constructors; refine role queries with Query::name. All set criteria must match (AND).
RadiusScale
A corner-radius family derived from one base measure, so a theme can be tighter or rounder from a single knob. The ratios (0.6 / 1.0 / 1.4 / 2.0 × base) are fenestra’s: a base of 10 reproduces R_SM / R_MD / R_LG / R_XL exactly, which is why the kit’s constants and the default scale agree.
Ramp
A 12-step color ramp.
Shadow
One drop shadow layer.
Sheen
A directional body sheen across an element’s face — the raking light that makes a translucent pane read as lit glass instead of a flat, uniform tint. A soft gradient wash, white at the end facing the light (top-left) grading through transparent to an optional faint shade at the far end, source-over the fill and clipped to the rounded silhouette. None (the default) paints no sheen. Pairs with SpecularEdge; both are set by Surface::Glass.
Span
One styled run of a rich_text paragraph. Unset properties inherit the paragraph’s text style.
SpecularEdge
A luminous specular edge rim — the iconic Liquid Glass perimeter light. A directional highlight that wraps the whole rounded silhouette, brightest on the edge that faces a fixed light (the top, by default) and fading toward the far side, so a translucent pane reads as lit, lensed glass rather than a flat outline. Painted as a gradient-brushed stroke just inside the silhouette, over an optional faint dark inner contact line that gives the rim a sense of thickness (the “double edge”). None (the default) paints no rim — every non-glass element stays byte-identical. Set by Surface::Glass; layered over the flat highlight_top bar on glass (both are painted).
SpringSpec
Spring parameters for physical motion.
StateLayer
The Material state-layer recipe: a translucent veil of a control’s content color, laid over its container to signal interaction — one set of opacities shared across the whole kit instead of per-widget hover colors. Hover is the lightest; focus and press share a stronger value; an in-progress drag is strongest. Disabled is expressed separately as a faint container plus dimmed content rather than an overlay.
StatusColors
The resolved colors of one status hue: tinted background, border, solid fill with its hover and pressed variants, and text.
Style
The complete style of an element: layout, paint, and text groups.
SurfaceBundle
The role-resolved description of a Surface: radius, fill/border roles, shadow token, optional top-highlight alpha, and an optional translucent Material. Surface::bundle returns it (pure, no theme — so radius/shadow/role ordering is unit-testable); SurfaceBundle::apply turns it into a concrete Style. Public so apps and Looks can compose custom materials from the fill/border roles.
TextLegibility
One text node’s legibility, measured on the real resolved colors and size — produced by Frame::legibility. Reports both the APCA Lc and the WCAG 2 ratio against the floor each standard sets for the rendered size, so an agent can prove a screen is readable without looking at a single pixel.
TextStyle
The text style group. color, line_height, and letter_spacing default to the theme/text-size tokens when None.
Theme
Design tokens resolved for one color mode.
ThemeSpec
A serializable theme recipe: the few numbers a theme generates from, not hundreds of resolved colors — so files stay tiny, stable across fenestra versions, and hand-editable.
Transition
Declares which properties animate between style states, and how.
VirtualData
Payload for virtualized rows (Element::virtual_rows): only the scrolled-into-view window of rows is materialized each frame.
WidgetId
A stable identity for one element in the tree.
WindowDesc
A secondary window the app wants open: presence in App::windows’s list opens it, removal closes it (exactly like modal state). The OS close button emits on_close — remove the desc in update to actually close.
WindowOptions
Options for the application window.

Enums§

AlignContent
Multi-line content alignment (flex wrap / grid).
AlignItems
Cross-axis alignment of children.
Breakpoint
The named width bands from Tailwind, mobile-first (smallest to largest). Self::at classifies a logical-pixel width into the largest band whose minimum width it meets.
ChromeElevation
The editor-chrome elevation vocabulary — Figma’s flat, layered panel shadows: two soft black drops over a 0.5px hairline ring. Flat and mode-independent (true black at low alpha), in deliberate contrast to the hue-tinted, themed ShadowToken used for product surfaces. The ring is a 0.5px shadow spread (no blur), which the painter renders as a crisp sub-pixel edge.
ChromeText
Editor-chrome text sizes — the dense panel type, 11–14px, distinct from the product TextSize scale (which starts at 12px for reading text). 11px is the base for nearly all panel/inspector text. Apply through the free-form size override: text(..).size_px(ChromeText::Sm.px()).tracking(ChromeText::Sm.tracking()).
Contrast
Contrast level for Theme::derive: scales every neutral step’s lightness distance from the background, so text and UI separation widen or soften from one knob. Standard reproduces the stock ramps exactly.
Cursor
Mouse cursor shown while hovering an element.
Direction
Main axis direction of a flex container.
Display
Display mode of a box.
DrawerSide
Which screen edge a drawer/sheet overlay is anchored to.
ElementFilter
A foreground filter applied to an element’s own rendered content (CSS filter:), as opposed to Style::backdrop_blur which filters what shows through a translucent element. Resolved by the shell’s two-pass renderer: the element’s pixels are read back, filtered on the CPU (deterministically), and composited in place. Each variant carries one lever in logical px (blur radius) or as a unit multiplier (1.0 = identity).
Elevation
How resting, same-plane surfaces (cards) convey separation. Floating surfaces — menus, popovers, modals, tooltips — always cast a shadow; this only governs cards that rest in the page. Set on a theme with Theme::with_elevation.
FamilyRole
Font family roles resolved through fontique.
FigureStyle
Figure (numeral) shape. Old-style figures have varying heights and descenders that sit naturally in serif prose; lining figures are uniform cap-height digits for data and UI. Default leaves the font’s own default figures untouched. Maps to the onum/lnum OpenType features.
GridTemplate
One entry of a grid template: a single Track, or a repeat(...) of tracks (including the responsive auto-fit / auto-fill). Build a Vec<GridTemplate> with Style::grid_cols / Style::grid_rows, which also accept plain Tracks (each wrapped as GridTemplate::Single).
InputEvent
A logical input event, shared by the windowed runner and headless SyntheticEvent injection.
JustifyContent
Main-axis distribution of children.
Key
A logical keyboard key (expanded for text editing in M5).
Kind
What an element fundamentally is.
Length
A length value for sizes and flex basis.
Mode
Light or dark color mode. Both are always generated from the same hue.
MotionDuration
Motion duration tokens, in milliseconds. Interaction feedback lives in the 100–200ms band; larger surfaces take longer. Exits are quicker than the matching entrance (see MotionDuration::exit_ms).
NumericSpacing
Figure spacing. Proportional figures are individually spaced for prose; tabular figures share one advance so columns of numbers align and values that update in place don’t jump. Default leaves the font’s own spacing. Maps to the pnum/tnum OpenType features.
OpticalSizing
How the opsz (optical size) variation axis of a variable font is set. Optical-size masters are drawn for a size range: fine, high-contrast cuts at large display sizes and sturdier, more open cuts at small text sizes, so a face looks right across the scale instead of one master scaled up and down. Maps to CSS font-optical-sizing / the opsz font-variation-settings axis.
Overflow
Overflow behavior per axis.
OverlayMode
How an overlay child opens and closes.
OverlayPlacement
Where an overlay is positioned.
Paint
Background paint.
PassKind
The operation a MultiPassSpec applies to its region’s pixels.
Position
Positioning scheme.
QueryError
Why a strict lookup failed — the non-panicking form used by machine-driven harnesses (scenario scripts).
Repeat
How many times a repeat(...) fragment is generated.
Semantics
Accessible role and state of an element, projected into the platform accessibility tree by the shell (AccessKit) and exposed headlessly via Frame::access_tree. Text, image, and input leaves project automatically; kit widgets set the rest.
ShadowToken
Shadow elevation tokens. Resolved to concrete layered shadows by the theme (dark mode multiplies alphas by 1.6). Ordered by depth (Xs < Sm < Md < Lg < Xl, in declaration order) so elevation roles can be compared — e.g. a floating surface’s shadow must out-rank a resting one’s.
Surface
One of the kit’s elevation materials: a semantic role that bundles a corner radius, a fill role, a border role, a shadow token, and an optional top highlight into one typed primitive, resolved against a Theme into a Style overlay. Floating roles (Popover/Menu/Modal/Glass) carry radii >= and shadow depth >= the resting roles (Card/Raised), so “every floating thing matches” is structural, not a convention re-typed at each call site. Thumb (a control handle) and Tooltip (an inverted chip) are deliberately exempt from that ordering.
SurfaceBorder
The border role of a surface bundle.
SurfaceFill
Which theme role a surface fill resolves to — a bundle is defined in semantic roles, never literal colors.
SurfaceRadius
The corner-radius shape of a surface bundle: one Uniform radius on every corner. A nested rounded child derives its concentric radius from this via SurfaceRadius::inner (passing the padding between them). The enum is #[non_exhaustive] to leave room for future shapes (e.g. per-corner radii).
SwipeDir
A recognized swipe (flick) direction, delivered by Element::on_swipe. Screen axes: Down is toward the bottom.
TextAlign
Horizontal text alignment.
TextMatch
How a text criterion matches an accessible string.
TextSize
The typographic scale. Sizes are logical px.
TextWrap
How text is broken into lines once shaping has wrapped it at the available width. parley line-breaks greedily (each line is filled as full as it can be); these modes refine that result by re-wrapping at a narrower width that the framework searches for. Part of the layout cache key (so a mode flip is never cached away).
Track
A grid track size — CSS <track-size>. Px and Fr are the common cases; MinMax plus the content keywords cover responsive templates.
TrackMax
The max argument of a Track::MinMax — a track’s ceiling.
TrackMin
The min argument of a Track::MinMax — a track’s floor. A floor cannot be flexible, so there is no fr here (CSS forbids it).
Weight
Font weights shipped with the embedded Inter family.
WritingDir
Writing direction for the UI — left-to-right (the default) or right-to-left. Set on the Theme (Theme::rtl); under Rtl the realized layout is mirrored horizontally and start-aligned text flips to the right edge.

Constants§

DEFAULT_CORNER_SMOOTHING
The stock kit-wide corner smoothing: 0.6 blends every rounded surface into an Apple-style squircle (continuous-curvature corners) instead of a plain circular arc. Calibrated by eye as the point where the squircle reads clearly without over-squaring small controls; set 0.0 for exact circular corners via Theme::with_corner_smoothing.
EASE_ACCELERATE
Accelerate easing for exits (Material 3): (0.4, 0, 1, 1) — easing away, then leaving briskly. Pair with MotionDuration::exit_ms.
EASE_DECELERATE
Decelerate easing for entrances (Material 3): (0, 0, 0.2, 1) — quick to arrive, easing to rest. Pair with an entrance transition.
EASE_EXIT
Exit easing; the historical name for EASE_ACCELERATE.
EASE_IN_OUT_CUBIC
Symmetric ease for camera moves and large surface transitions (CSS easeInOutCubic): (0.65, 0, 0.35, 1). The canvas camera (crate::canvas) eases zoom-to-fit and zoom-to-selection with it — the curve Figma and tldraw use for canvas motion.
EASE_STANDARD
The Material 3 easing families. Use EASE_STANDARD for two-way state changes (hover, press, color), EASE_DECELERATE for entrances (an element flying in and settling), and EASE_ACCELERATE for exits (an element leaving the screen). Entrances ease out (fast then gentle); exits ease in (gentle then fast) so they clear quickly.
FOCUS_RING
The focus ring token: a 3px halo at 0.5 alpha, flush outside the border.
GLASS_LIGHT_DEG
The fixed light azimuth for the glass specular rim, in CSS gradient degrees (0 = up, 90 = right). fenestra puts the light at the top so a floating glass pane catches light along its upper edge and shades toward the bottom. Used by SpecularEdge::glass; the body Sheen rakes from the upper-left on its own diagonal axis.
GRADIENT_STEPS
Sub-segments generated per anchor pair when expanding an OKLCH gradient (linear_gradient / radial_gradient). Calibrated so a full hue-arc ramp shows no perceptible banding once vello resamples the stops into its ~512-texel sRGB ramp LUT (≈32 texels per sub-segment at 16). A perceptual target, not a hard spec number: raise it if a wide-hue ramp ever bands at a sub-segment joint.
MAIN_WINDOW
The key App::view_for receives for the main window.
MEASURE_CH
The default reading measure, in CSS ch units (1ch = the advance of the digit '0'; see crate::Length::Ch). Set to 52 so a proportional body face renders ~66 characters per line — the classic optimum for sustained reading (the comfortable band is 45–75). The value is below 66 on purpose: '0' is wider than the average glyph, so a column of N ch holds somewhat more than N real characters; 52ch lands the rendered line near 66. A wider face fits fewer characters per line, a narrower one more. Prose containers cap their width here via crate::Style::measure.
PRESS_SCALE
Pressed controls scale to this factor for tactile press feedback (Material 3 uses 0.96–0.97). Applied as a paint-time transform about the control’s center, so it never disturbs layout or hit-testing, and it animates through the same transition as the press color.
R_FULL
Fully-rounded (pills, avatars); clamped to half the box size at paint.
R_LG
Large radius (cards): 14px.
R_MD
Medium radius (controls: buttons, inputs): 10px.
R_SM
Small radius (badges, small chips): 6px.
R_XL
Extra-large radius (modals): 20px.
SP0
Spacing constants on a 4px grid, in logical pixels.
SP0_5
2px.
SP1
4px.
SP2
8px.
SP3
12px.
SP4
16px.
SP5
20px.
SP6
24px.
SP8
32px.
SP10
40px.
SP12
48px.
SP16
64px.
STATE_LAYER
The state-layer token.

Traits§

App
An application: state, a pure view of it, and a message-driven update.
Clipboard
Read/write access to a clipboard.
IntoChildren
Anything that can become a child list. Implemented for every IntoIterator of one Into<Element> type (vecs, arrays, map chains) and for tuples of up to twelve different Into<Element> types. Marker disambiguates the two families; let inference fill it.

Functions§

build_frame
Lays out an element tree into a Frame at the given logical size and DPI scale. A root with Auto width/height is stretched to the canvas.
build_scene
Convenience: lays out and paints in one call with throwaway state.
click_msg_of
The message an enabled element with the given id would emit when clicked, if any. The shell uses it to honor accessibility action requests (AccessKit Action::Click) without synthesizing pointer events.
col
A flex column.
conic_gradient
A conic (sweep) Paint (see Paint::ConicGradient) centered at center (unit coordinates within the element rect), sweeping colors once around the full circle as a smooth OKLCH ramp (oklch_stops with GRADIENT_STEPS). Fewer than two colors collapse to a solid fill. Reads from theme tokens — never a raw hex literal.
dispatch
Dispatches one event against the last laid-out frame, updating retained interaction state and collecting emitted messages.
div
A plain container box (flex row by default, like taffy).
divider
A horizontal hairline rule in border_subtle, 1px tall and full width. For a vertical rule, override with .w(1.0) and .h_full().
frame_epoch
The current frame-build epoch: the number of the frame build_frame is currently (or most recently) laying out. It is bumped once per frame, before the tree is walked — so the lazy row builder of a virtualized container (Element::virtual_rows), which runs during the walk, can key a per-frame scratch budget off it: work a row does on materialization (e.g. decoding an image) is then bounded once per frame across all the rows the window covers, instead of resetting per row (which lets a tiny row_height collapse the window onto every row, each with a full, independent budget). Returns 0 before the first frame has been built.
image_from_data
An image leaf rendering an already-decoded ImageData payload (from image_payload), sized to it. Building many elements or frames from clones of one payload shares a single reference-counted pixel blob, so a decoded-image cache never re-decodes or re-copies. See image_rgba8 for the owned-Vec convenience wrapper.
image_payload
Package already-decoded straight-alpha RGBA8 pixels (row-major, 4 bytes per pixel) into a shareable ImageData: the buffer becomes an atomically reference-counted blob, so cloning the result and handing it to image_from_data shares the one allocation instead of re-decoding or copying — the reuse path a decoded-image cache wants. If pixels holds fewer than width * height complete rows, the payload shrinks to the rows provided (its height reflects that), matching image_rgba8.
image_rgba8
An image leaf showing straight-alpha RGBA8 pixels (row-major, 4 bytes per pixel). Sized to the image by default, stretched when styled otherwise, and painted clipped to the corner radius — so .rounded_full() crops a square source into a round avatar. If pixels holds fewer than width * height complete rows, the element shrinks to the rows actually provided instead of panicking.
lc
APCA Lc for text painted over bg. Positive for dark-on-light, negative for light-on-dark; the magnitude (0..~108) is the perceptual contrast.
lc_abs
The magnitude of lc — the form used by “meets a target” checks, which care about contrast strength, not polarity.
linear_gradient
A linear Paint whose colors are spaced evenly across 0.0..=1.0 and expanded into a perceptually smooth OKLCH ramp (oklch_stops with GRADIENT_STEPS). angle_deg is CSS-style (0 up, 90 right). Reads from tokens, e.g. bg(linear_gradient(135.0, [t.accent, t.accent_text])). Fewer than two colors collapse to a solid fill (one color, or transparent for none).
meets
Whether text on bg reaches an Lc target (by magnitude).
oklch
Builds an sRGB Color from OKLCH (lightness 0..=1, chroma, hue degrees), gamut-mapping by reducing chroma — never lightness — when the color is out of gamut. This is the framework’s color primitive: theme ramps, Looks, and data-viz palettes are all built from it, so a generated color is always in-gamut and keeps its intended lightness.
oklch_of
The OKLCH components [L, C, H] of a color — the inverse of oklch. Hue is 0.0 for achromatic colors (where it is otherwise undefined), so the result round-trips cleanly back through oklch. Use it to adapt an existing color (e.g. lift a categorical swatch for a dark background).
oklch_stops
Expands OKLCH-interpolated color stops between anchor colors. Each adjacent anchor pair is walked in steps sub-segments through OKLCH (shortest hue arc, achromatic-endpoint handling, gamut-clamped — the exact OKLCH lerp the transition engine animates colors along), so the rendered ramp stays perceptually even with no desaturated “gray dead-zone” through the middle of a wide-hue transition. The vello renderer interpolates the returned stops in sRGB, but they sit densely on the OKLCH curve, so the on-screen ramp tracks it. Anchors are (offset, color) with offsets in 0.0..=1.0; they are sorted ascending and the endpoints are preserved exactly. Colors must come from theme tokens or oklch / oklch_of — never a raw hex literal.
path
A vector path drawn in viewbox coordinates and scaled to the element rect (sized to the viewbox by default). stroke is a width in viewbox units; None fills instead. Painted in the resolved text color.
radial_gradient
A radial Paint (see Paint::RadialGradient for center / radius) whose colors are spaced evenly across 0.0..=1.0 and expanded into an OKLCH ramp (oklch_stops with GRADIENT_STEPS). Fewer than two colors collapse to a solid fill (one color, or transparent).
raw_input
A bare single-line text input leaf. Most apps want the styled fenestra_kit text_input instead; this is the primitive it wraps. Focusable, shows the text I-beam, and emits on_input per edit.
raw_text_area
A bare multiline text area leaf: text wraps to the element width, Enter inserts a newline, arrows move by line, and the measured height grows with the wrapped content (constrain it with .min_h/.max_h plus an outer scroll container). Most apps want the styled fenestra_kit text_area instead; this is the primitive it wraps.
refresh_hover
Recomputes the hover set against a freshly-built frame without emitting messages — used after scrolling moves content under a stationary pointer. Returns true when the hover set changed.
required_lc
The minimum APCA Lc magnitude that text of size_px logical pixels at font weight (OpenType 100..900) needs to be read fluently — APCA’s readability criterion as a function instead of a fixed floor. Smaller and thinner text needs more contrast; larger and heavier text needs less.
responsive
A container that chooses its own layout from its measured size — a container query, the counterpart of window-size App::view_at. f(available) receives this container’s own content size in logical px from the previous frame (the layout the motion system already records) and returns the element to lay out in its place.
responsive_hinted
responsive with an explicit first-frame size: f(hint) builds the initial frame (before any measurement exists), removing the one-frame “smallest branch” flash when the rough size is known up front. See responsive for the convergence model and the identity / monotonicity caveats.
rich_text
A paragraph of styled runs: spans wrap together as one layout, and each span may override weight, color, size, family, or italic.
row
A flex row.
run
Opens a window and runs the app until the window closes. Msg: Send because App::init’s proxy delivers messages across threads.
spacer
Flexible empty space (flex grow 1).
span
A styled run for rich_text.
stack
A z-stack: children occupy the same rect and paint in order.
text
A text run.
tracking_em
Optical tracking (letter spacing) in em for a font size in logical px, from Inter’s published dynamic-metrics formula -0.0223 + 0.185·e^(-0.1745·px): a hair positive at caption sizes, tightening smoothly as text grows. Applies to any size, including free-form display sizes, instead of a handful of hand-set steps.
wcag2_passes
Whether text on bg clears the WCAG 2 AA threshold: 4.5:1 for normal text, 3.0:1 for large text (large = true: >= 18pt, or >= 14pt bold).
wcag2_ratio
The WCAG 2 contrast ratio between two opaque colors: (L1 + 0.05) / (L2 + 0.05) with the lighter luminance on top. Ranges from 1.0 (identical) to 21.0 (black on white). APCA (lc) models perception better, but WCAG 2 is the shipping legal standard, so the verification surface reports both.

Type Aliases§

Color
A convenient alias for the color type used for Brush.
ThemedFn
A theme-aware partial style overlay: interaction variants and kit widgets’ deferred base styling both use this shape.