Skip to main content

Module kit

Module kit 

Source
Expand description

Visual kits (docs/kit.md): what a component looks like, as data from the theme and drawing handlers, compiled once when the theme is installed.

Experimental: may change in any release (docs/stability.md).

egui-pop’s widgets keep the behaviour (clicks, drags, focus, the keyboard, accessibility) and compute a State; the kit measures and paints. Every component is described with the same words: per state (rest, hover, active, focus, selected, disabled) a box (BoxStyle: fill, border, radius, text colour, indicator), plus a shape, the name of the handler that draws it (Primitive). A token is always component.state.term (tab.hover.fill), or component.term for what does not change with the state (tab.shape, tab.padding-x).

Nothing is resolved while drawing: install compiles the theme into a Kit of plain values, with every combination of states merged ahead (32 boxes per component), and the handlers picked by name. Drawing reads fields and makes one call per part.

The default look is a kit like any other: the tab.* tokens of the built-in pop-dark theme, which every theme extends, drawn by the handlers shipped here (box, underline). An application adds its own handlers with register_tab_shape before installing a theme that names them.

Structs§

AreaLineKit
The line between two areas while hovered or focused (hover) and while dragged (active), from side-area.hover.border-width, side-area.hover.border-color and their active twins. A state whose tokens say nothing is drawn with egui’s widget stroke, as before the tokens existed (Kit::area_line_stroke). The guide shown while a side area’s line is dragged far enough to fold the area on release (fold) takes side-area.fold.border-width and border-color (Kit::fold_guide_stroke).
BoxStyle
What a part looks like in one state.
Component
A component’s data and the handler that draws it.
ComponentKit
The data of a component: its boxes per state, and what does not change with the state.
DragCursorKit
The drag cursors of a kit, by kind.
FoldGuide
The fold guide’s terms, from side-area.fold.border-width and side-area.fold.border-color: each one the theme leaves out keeps egui_stack’s guide stroke (LayoutStyle::snap_guide).
Glyphs
The icon of each role, compiled from the kit’s tokens: read by index while drawing.
Kit
A compiled kit: every component egui-pop draws through one.
KitCx
What a handler paints with.
KitSource
A kit to install: its data and its handlers.
Kits
The kits installed, one per egui theme (the same one twice for a theme alone).
Part
What a part is asked to paint.
ScopedKit
The scoped visuals of every Stock kind, per tone (one entry for a component whose tokens give no tone), compiled with the kit.
ScopedVisuals
egui’s visuals for a component in one tone, compiled with the kit. ScopedVisuals::apply writes them into a scope’s [Visuals]; a field left None keeps egui’s value.
ScrollBarKit
The scroll bars’ terms of a kit.
SectionsKit
The sections’ terms of a kit beside their components’ boxes.
Shapes
The handlers a kit’s shape tokens can name, per component.
State
The states a part can be in, combined (a selected tab under the pointer is SELECTED | HOVER). No flag is the resting state.
States
A component’s boxes for every combination of states, merged when the kit is compiled, and per tone when its tokens give tones (Tone, kit/tone.rs).
WindowEdgeKit
The rest of a window’s edge, beside WindowKit::outline: the line while another window has the focus and the corners rounded while the window floats free.
WindowKit
The window’s terms of a kit.

Enums§

Align
Where a label goes along its part.
AreaLineState
The line between two areas in one state.
ButtonsHover
Which window buttons are drawn hover (title-bar.buttons-hover).
ButtonsSide
Where the window buttons go on the title bar (title-bar.buttons-side).
Corners
Which corners of a box are rounded.
CountPlacement
Where a section’s count goes on its band (section-count.placement).
Glyph
What a small mark means. The vocabulary is fixed: a widget needing a new mark adds a role here, never a shape of its own.
Placement
Where a scroll bar goes (scroll-bar.placement).
Side
A side of a box.
Stock
The egui widgets a kit restyles in a scope, each through a component of the kit (the scoped mapping of its boxes).
Tone
What a part says, the same names for every component. Neutral is the component’s own box (no tone); the others are read from component.tone.<name>, their defaults aliasing the system’s status tokens (accent.default, info, success, warning, danger, text.muted; record aliases danger too). Serialized by its token name ("danger").
Visibility
When a scroll bar shows (scroll-bar.visibility).
WindowCorners
The corners asked of the system for a window drawn by the application (window.corners), where it can round them (Windows 11).

Constants§

COMPONENTS
The components a kit has (their token name), with the handler drawn when a theme names none it knows.

Traits§

Primitive
A component’s drawing handler. Every component’s handlers have this shape; D is the component’s data.

Functions§

install
Compiles the kit of tokens with the registered handlers and installs it for both of egui’s themes.
install_variants
Compiles the kits of a dark and a light theme (one kit when they are the same set) and installs them. Called by theme::install_variants, between frames.
label_rect
Where a label of size goes in a part: along it by the component’s align, inside its room less the padding, centred across; on whole physical pixels is the painter’s business.
paint_box
Paints a box: its fill and border with corners rounded by its radius, and its indicator on side. Strokes are whole physical pixels.
paint_indicator
paint_label
Paints a part’s label where label_rect puts it, in its state’s text, on whole physical pixels. What handlers do unless they draw labels their own way.
paint_ring
Paints a box’s focus ring, if its state gives one: an outline ring_offset outside the box, following its corners. Every handler calls it last, so the ring is above the box and its label.
register_shape
Registers a handler for a component (one of COMPONENTS) under a name its shape token can give. In use from the next theme install.
register_tab_shape
Registers a tab handler (register_shape for tab).