In development. It changes without notice.
Topic
Canvas, Theme & Layout
What every screen draws with: the canvas, the design tokens, the theme, the roles of text and the rules of layout.
A screen reads the device's profile (its size, its inputs, its colors) and the tokens, and never a board's name. The canvas is an interface, so a test can record what a component draws.
- See also
- Render Canvas, Interface Components
Files | |
| file | src/ |
| Time-based value tween for fluid UI transitions (host-testable). | |
| file | src/ |
| The single drawing-backend seam for the in-house UI library. | |
| file | src/ |
| Where the rows of a column land in the band its screen has for it. | |
| file | src/ |
| Orthogonal device-capability model for the responsive UI layer. | |
| file | src/ |
| Perceptually-uniform (OKLab) RGB565 gradient stop-LUTs. | |
| file | src/ |
| Key bytes as text a person can read back: hex in groups and base64. | |
| file | src/ |
| Display-size heuristics shared by popups and panels. | |
| file | src/ |
| Responsive layout seam: a kleidos:: | |
| file | src/ |
| The Kleidos mark's body and keyhole in sub-pixel units, as a color canvas draws them. | |
| file | src/ |
| Password-mask glyph and a bounded UTF-8 mask-row builder (host-testable). | |
| file | src/ |
| How long an unmasked secret stays on screen before it hides itself. Pure, host-testable. | |
| file | src/ |
| Central dirty-only repaint driver for every screen. | |
| file | src/ |
| Visual grouping for a secret the user has to copy out by hand. | |
| file | src/ |
| What a screen paints on its own clock while the panel sleeps: nothing. | |
| file | src/ |
| Segmented page-indicator geometry + slide timing (host-testable). | |
| file | src/ |
| Text roles chosen by what the text is for, resolved per panel. | |
| file | src/ |
| Unified color theme for all device variants (RGB24 + RGB565). | |
| file | src/ |
| Runtime light/dark theme selection (persisted), applied to the display. | |
| file | src/ |
| Consolidated design tokens (color + spacing + radius + typography). | |
| file | src/ |
| Row geometry of a value editor on the touch-control boards. Pure, host-testable. | |
Namespaces | |
| namespace | kleidos:: |
| Integer helpers of a MarkBodyShape, for pixel boxes from sub-pixel lengths. | |
| namespace | kleidos:: |
| Motion tokens: the timings every surface shares (the design system's "motion"). | |
Classes | |
| class | kleidos:: |
| Interpolates a scalar from a start to a target over a duration. More about kleidos:: | |
| class | kleidos:: |
| Abstract immediate-mode drawing surface. More about kleidos:: | |
| struct | kleidos:: |
| One row of the column. More about kleidos:: | |
| struct | kleidos:: |
| Physical input affordance of the device. More about kleidos:: | |
| struct | kleidos:: |
| Orthogonal description of a target device's UI-relevant traits. More about kleidos:: | |
| struct | kleidos:: |
| Integer rectangle in screen space (top-left origin, pixels). More about kleidos:: | |
| struct | kleidos:: |
| Safe-area insets in pixels (content margins from the screen edge). More about kleidos:: | |
| class | kleidos:: |
| Per-screen responsive context, derived from a DeviceProfile. More about kleidos:: | |
| struct | kleidos:: |
The mark's body and keyhole, centered on the center of pixel (cx, cy). More about kleidos:: | |
| struct | kleidos:: |
| The inks of a MarkBodyShape, RGB565. More about kleidos:: | |
| class | kleidos:: |
| The open-for-a-while window of one unmasked secret. More about kleidos:: | |
| struct | kleidos:: |
| A circular section, addressed by its bounding square for invalidation. More about kleidos:: | |
| class | kleidos:: |
| Drives dirty-only repaint for one screen: repaints a section only when it changed (or a full invalidation is pending) and blits once per tick. More about kleidos:: | |
| struct | kleidos:: |
| How a secret of a given length lays out in a monospace row (secretLines). More about kleidos:: | |
| struct | kleidos:: |
| One row of a secret broken for a monospace face (breakSecret): a byte range of the value, so the row is drawn from the secret in place. More about kleidos:: | |
| struct | kleidos:: |
| What breakSecret filled. More about kleidos:: | |
| class | kleidos:: |
| Keeps a value that is wrong once stale off a sleeping panel. More about kleidos:: | |
| struct | kleidos:: |
| Resolved horizontal layout for the segmented tab indicator. More about kleidos:: | |
| struct | kleidos:: |
| A text role and the pixel size it lays out at. More about kleidos:: | |
| struct | kleidos:: |
| Spacing scale in pixels (xs..xl + action-bar shelf), per density. More about kleidos:: | |
| struct | kleidos:: |
| Per-role target text height in pixels, per density (resolved by PPI). More about kleidos:: | |
| struct | kleidos:: |
| Corner-radius scale in pixels, the design system's radius. More about kleidos:: | |
| struct | kleidos:: |
| Band heights a board's design sheet fixes, in pixels (0 = derive the band from the font and spacing scales, as every other board does). More about kleidos:: | |
| struct | kleidos:: |
| Resolved per-device pixel metrics (font + spacing) for one profile. More about kleidos:: | |
| struct | kleidos:: |
| Numerator/ | |
| struct | kleidos:: |
| The three rows of a touch value editor. More about kleidos:: | |
Functions | |
| constexpr float | kleidos:: |
Quadratic ease-out at normalized progress t (clamped to [0,1]). | |
| constexpr float | kleidos:: |
Quadratic ease-in-out at normalized progress t (clamped to [0,1]). | |
| constexpr float | kleidos:: |
Ease-out "back" at normalized progress t (clamped to [0,1]). | |
| constexpr float | kleidos:: |
Evaluate a named easing curve at normalized progress t. | |
| constexpr bool | kleidos:: |
Place rows top to bottom in the band from top to bottom. | |
| uint16_t | kleidos:: |
| Interpolate between two RGB565 colors in OKLab space. | |
| void | kleidos:: |
| Bake an N-entry RGB565 LUT spanning a list of RGB565 stops in OKLab. | |
| uint16_t | kleidos:: |
| Baked OKLab vertical-depth color for a selection band, top → bottom. | |
| uint16_t | kleidos:: |
| Baked OKLab vertical-depth color for the header bar, top → bottom. | |
| std::size_t | kleidos:: |
Write len bytes as lowercase hex in space-separated groups of groupBytes bytes ("a1b2 c3d4 …"). | |
| std::size_t | kleidos:: |
Write len bytes as standard base64 (RFC 4648, with padding). | |
| constexpr bool | kleidos:: |
| True when the smaller display dimension is below the tiny breakpoint. | |
| bool | kleidos:: |
| Runtime helper that queries the active display HAL. | |
| constexpr Rect | kleidos:: |
Split a rect into count equal cells along axis, with gap. | |
| constexpr Rect | kleidos:: |
Carve a fixed-size band off one edge of track, return the rest. | |
| constexpr Rect | kleidos:: |
| Every pixel the body, its outline and the keyhole can touch. | |
| std::size_t | kleidos:: |
Write count UTF-8 mask bullets into dst, NUL-terminated, bounded. | |
| std::size_t | kleidos:: |
Copy value into out with a space every kSecretGroupSize. | |
| constexpr std::size_t | kleidos:: |
Length groupSecret produces for a value of length characters. | |
| SecretLayout | kleidos:: |
| Rows a monospace secret takes in a given width, and whether to group it. | |
| SecretBreak | kleidos:: |
Break a secret into rows of at most perRow characters for a monospace face, ending a row after a separator where one falls late in it. | |
| constexpr bool | kleidos:: |
| Whether a repaint that answers no input may paint now. | |
| constexpr TabIndicatorGeometry | kleidos:: |
| Compute the segmented indicator geometry for a given content width. | |
| constexpr TabIndicatorGeometry | kleidos:: |
| Compute the icon-tab-strip underline geometry for a content width. | |
| constexpr int16_t | kleidos:: |
Left-edge X of the active pill for segment index index. | |
| constexpr TextRole | kleidos:: |
| The role for secondary text the owner reads in order to act. | |
| constexpr uint16_t | kleidos:: |
| Compile-time conversion from a 24-bit RGB color to 16-bit RGB565. | |
| ThemeMode | kleidos:: |
| The per-device default mode: Light on e-paper, Dark on color panels. | |
| ThemeMode | kleidos:: |
| The active theme mode (the persisted value, or the default before init). | |
| bool | kleidos:: |
| void | kleidos:: |
| Load the persisted theme mode (or the per-device default) and apply it to the display. Call once during setup(), after the display HAL is up. | |
| bool | kleidos:: |
| Set, persist (NVS), and apply the theme mode. The caller should request a full screen redraw afterwards so the new polarity is rendered. | |
| constexpr int16_t | kleidos:: |
Reference viewing distance of density band d (0.1 mm units). | |
| constexpr int16_t | kleidos:: |
| Converts a physical length to panel pixels, rounding up. | |
| constexpr int16_t | kleidos:: |
| Rounds a pixel length up to the next multiple of a grid step. | |
| constexpr FontScale | kleidos:: |
| Raise each font role to at least the matching floor. | |
| constexpr int16_t | kleidos:: |
| Resolve a physical target (0.1 mm) to a clamped pixel size. | |
| constexpr const FontScale & | kleidos:: |
| Select the physical font targets (0.1 mm) for a density preset. | |
| constexpr const SpaceScale & | kleidos:: |
| Select the physical spacing targets (0.1 mm) for a density preset. | |
| constexpr Metrics | kleidos:: |
| Resolve the full per-device pixel metrics for a profile's geometry. | |
| constexpr TouchEditorRows | kleidos:: |
The editor's rows under a header headerH tall, full width less the small gap on both sides, one tap target tall, one small gap apart. | |
| constexpr Rect | kleidos:: |
| The Save button that ends an editor's action row. | |
| constexpr int16_t | kleidos:: |
Lay cells of the given widths across row, left to right, sharing what is left of the row out as equal gaps between them. | |
Variables | |
| constexpr uint32_t | kleidos:: |
| Default tween duration (ms): snappy menu-scroll / highlight slide. | |
| constexpr float | kleidos:: |
| Overshoot strength for easeOutBack (the classic back-ease constant). | |
| constexpr std::size_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| Entry count of the baked header-depth LUT (top → bottom of the header bar). | |
| constexpr int16_t | kleidos:: |
| Threshold below which a screen is considered "tiny". Keep this aligned with the smallest panel the design system draws for. | |
| constexpr int32_t | kleidos:: |
| Sub-pixel steps per pixel of a MarkBodyShape length. | |
| constexpr int32_t | kleidos:: |
| The scale of MarkBodyShape:: | |
| constexpr char32_t | kleidos:: |
| Canonical password-mask code point: U+2022 BULLET (atlas-confirmed). | |
| constexpr const char * | kleidos:: |
| UTF-8 encoding of kMaskGlyph (0xE2 0x80 0xA2), NUL-terminated. | |
| constexpr std::size_t | kleidos:: |
| Bytes the bullet occupies in UTF-8 (3) — size mask buffers as count * 3 + 1. | |
| constexpr const char * | kleidos:: |
| First documented fallback: U+00B7 MIDDLE DOT (·), UTF-8 0xC2 0xB7. | |
| constexpr char | kleidos:: |
| Last-resort fallback: ASCII * (U+002A), single byte. | |
| constexpr uint32_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr std::size_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Active-pill slide duration in ms when switching pages (Refresh:: | |
| constexpr int16_t | kleidos:: |
| Icon tab strip band height in pixels (icons + underline). | |
| constexpr int16_t | kleidos:: |
| Tab icon edge in pixels (drawn centered in each cell). | |
| constexpr int16_t | kleidos:: |
| Active-cell underline thickness in pixels. | |
| constexpr int16_t | kleidos:: |
| Numerator of the underline-width fraction of a cell (56 % of the cell). | |
| constexpr int16_t | kleidos:: |
| Denominator of the underline-width fraction of a cell. | |
| constexpr uint32_t | kleidos:: |
| Pure black background. | |
| constexpr uint32_t | kleidos:: |
| Cards, panels, headers. | |
| constexpr uint32_t | kleidos:: |
| Raised interactive key face. | |
| constexpr uint32_t | kleidos:: |
| Selected / focus highlight. | |
| constexpr uint32_t | kleidos:: |
| Cyan — CTA, titles, cursor. | |
| constexpr uint32_t | kleidos:: |
| Primary text. | |
| constexpr uint32_t | kleidos:: |
| Secondary / hint text. | |
| constexpr uint32_t | kleidos:: |
| Red — error, delete. | |
| constexpr uint32_t | kleidos:: |
| Green — OK, connected. | |
| constexpr uint32_t | kleidos:: |
| Yellow — lockout, caution. | |
| constexpr uint32_t | kleidos:: |
| Orange — WiFi, info. | |
| constexpr uint32_t | kleidos:: |
| Dark gray — dim tracks, versions. | |
| constexpr uint32_t | kleidos:: |
| Row dividers, inactive track borders. | |
| constexpr uint32_t | kleidos:: |
| Success container fill. | |
| constexpr uint32_t | kleidos:: |
| Alert / destructive container fill. | |
| constexpr uint32_t | kleidos:: |
| Destructive popup title bar. | |
| constexpr uint32_t | kleidos:: |
| Caution popup title bar. | |
| constexpr uint32_t | kleidos:: |
| Letter tile fill: indigo. | |
| constexpr uint32_t | kleidos:: |
| Letter tile fill: violet. | |
| constexpr uint32_t | kleidos:: |
| Letter tile fill: grape. | |
| constexpr uint32_t | kleidos:: |
| Letter tile fill: pink. | |
| constexpr uint32_t | kleidos:: |
| Letter tile fill: slate. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kBg. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kSurface. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kElevated. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kAccent. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kPrimary. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kText. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTextSec. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kWarning. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kSuccess. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kLockout. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kInfo. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kMuted. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kSubtle. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kSuccessFill. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kWarningFill. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kWarningTitle. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kCautionTitle. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTileIndigo. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTileViolet. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTileGrape. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTilePink. | |
| constexpr uint16_t | kleidos:: |
| Pre-computed RGB565 for kTileSlate. | |
| constexpr uint16_t | kleidos:: |
| Pure black background. | |
| constexpr uint16_t | kleidos:: |
| Cards, panels, headers. | |
| constexpr uint16_t | kleidos:: |
| Raised interactive key face. | |
| constexpr uint16_t | kleidos:: |
| Selected / focus row fill. | |
| constexpr uint16_t | kleidos:: |
| Cyan — CTA, titles, cursor. | |
| constexpr uint16_t | kleidos:: |
| Primary text. | |
| constexpr uint16_t | kleidos:: |
| Secondary / hint text. | |
| constexpr uint16_t | kleidos:: |
| Red — error, delete. | |
| constexpr uint16_t | kleidos:: |
| Green — OK, connected. | |
| constexpr uint16_t | kleidos:: |
| Yellow — lockout, caution. | |
| constexpr uint16_t | kleidos:: |
| Orange — WiFi, info. | |
| constexpr uint16_t | kleidos:: |
| Dark gray — dim tracks. | |
| constexpr uint16_t | kleidos:: |
| constexpr uint16_t | kleidos:: |
| Success container fill — a light foreground sits on this, never on kSuccess. | |
| constexpr uint16_t | kleidos:: |
| Alert / destructive container fill — same contract as kSuccessFill. | |
| constexpr uint16_t | kleidos:: |
| Destructive popup title bar — light text sits on it. | |
| constexpr uint16_t | kleidos:: |
| Caution popup title bar — light text sits on it. | |
| constexpr uint16_t | kleidos:: |
| Letter-tile fills (color.tile.*): no status hue and not the focus cyan. | |
| constexpr uint16_t | kleidos:: |
| Letter-tile fill: violet. | |
| constexpr uint16_t | kleidos:: |
| Letter-tile fill: grape. | |
| constexpr uint16_t | kleidos:: |
| Letter-tile fill: pink. | |
| constexpr uint16_t | kleidos:: |
| Letter-tile fill: slate. | |
| constexpr uint32_t | kleidos:: |
| motion.fade: the one transition length every surface shares (ms). | |
| constexpr uint32_t | kleidos:: |
| motion.longpress: how long a press lasts before it counts as a hold (ms). | |
| constexpr uint32_t | kleidos:: |
| constexpr int16_t | kleidos:: |
| PPI of the reference panel whose tuned px define the Compact band (the Sticks'). | |
| constexpr int16_t | kleidos:: |
| Viewing distance the Compact band's tuned px assume (a Stick at the wrist). | |
| constexpr int16_t | kleidos:: |
| Viewing distance the Roomy band's tuned px assume (a 320×240 board on the desk). | |
| constexpr int16_t | kleidos:: |
| PPI of the reference device whose tuned px define the Roomy band (three-button). | |
| constexpr RadiusScale | kleidos:: |
| Radius scale is density-independent. | |
| constexpr int16_t | kleidos:: |
| Row / band floor, 0.1 mm. | |
| constexpr int16_t | kleidos:: |
| Isolated hit-box floor, 0.1 mm. | |
| constexpr int32_t | kleidos:: |
| One inch in 0.1 mm units. | |
| constexpr int16_t | kleidos:: |
| constexpr Bands | kleidos:: |
| constexpr int16_t | kleidos:: |
| constexpr FontScale | kleidos:: |
| The M5Cardputer ADV's type ladder (small, body, heading, large, mono). | |
| constexpr Bands | kleidos:: |
| The M5Cardputer ADV's fixed bands: header, vault row, menu row. | |
| constexpr BudgetCap | kleidos:: |
| small <= minorDim / 6. | |
| constexpr BudgetCap | kleidos:: |
| body <= minorDim / 5. | |
| constexpr BudgetCap | kleidos:: |
| mono <= minorDim / 5. | |
| constexpr BudgetCap | kleidos:: |
| heading <= minorDim / 4. | |
| constexpr BudgetCap | kleidos:: |
| constexpr BudgetCap | kleidos:: |
| Spacing values are capped to keep at least a usable content band on tiny panels. | |
| constexpr int16_t | kleidos:: |
Enumeration Type Documentation
Axis #
Axis a track distributes along.
ColorMode #
Color capability of the panel.
Drives the color strategy: Mono1 panels (the CoreInk's e-paper) collapse the palette to ink and paper; no board has a Grayscale panel. Not a bool, so a new mode is added without a breaking change.
Density #
UI density preset — the element-SIZE axis (spacing + font role target).
Two density presets, the same tokens, scaled values. Orthogonal to orientation: a Compact device can be Portrait (the Sticks) or Landscape (the M5Cardputer ADV); a Roomy device is Landscape (the 320×240 panels). Density means one thing: how big elements are.
Density itself is derived from physical size + resolution together by ui::
Easing #
Selectable easing curve applied by a Tween.
The default preserves the original ease-out behavior so every existing tween is unchanged; callers opt into a different feel per animation.
Nav #
Focus-movement semantics — what navigation means on this device.
Deliberately separate from Capabilities (the physical inputs). The CoreInk's dial (▲ up / ● select / ▼ down) is Vertical navigation realized by a directional three-input cluster (dialVertical), not the same thing as three A/B/C keys or touch zones, even though both have three inputs.
Orientation #
Screen arrangement axis — drives how a screen lays things out.
Derived from the effective (post-rotation) width vs height, and overridable at runtime via DeviceProfile::
Refresh #
Refresh behavior of the panel.
Drives the animation budget: Epaper panels have slow multi-flash waveforms, so the UI must reduce-motion and coalesce a whole screen into one commit. Not a bool, so another kind of panel can be a third value.
StaleStep #
What a screen does this tick with a value that is wrong once stale.
ThemeMode #
Function Documentation
applyEasing() #
Evaluate a named easing curve at normalized progress t.
- Parameters
-
Name Direction Meaning easing in Curve to apply. t in Normalized progress in [0,1] (clamped per-curve).
- Returns
- Eased progress.
base64() #
Write len bytes as standard base64 (RFC 4648, with padding).
- Parameters
-
Name Direction Meaning bytes in The key bytes. len in How many bytes to encode. out out Text buffer, always NUL-terminated when cap> 0.cap in Size of outin bytes; needs 4 * ceil(len / 3) + 1.
- Returns
- Characters written (excluding the NUL), or 0 when
outis too small.
breakSecret() #
Break a secret into rows of at most perRow characters for a monospace face, ending a row after a separator where one falls late in it.
A password has no spaces to wrap on, but most have joints. Cut by width alone, "Demo-Pass-Only-7!" breaks three letters into "Only", which someone copying it by hand reads as two words the password does not have; ended at its joint it reads "Demo-Pass-" / "Only-7!". A row therefore ends just after the last separator in its back half (a hyphen, underscore, period, slash, backslash, colon, semicolon, comma, plus, equals sign, vertical bar, ampersand, tilde or at sign), and is cut hard at perRow characters where there is none. A space is never a joint: at the end of a centered row it would vanish. A character is a UTF-8 code point, so no row splits one.
Ending rows at joints can take more rows than cutting them hard. When the joints need more rows than rows holds, the whole value is cut hard instead, which takes the fewest; a value that does not fit even then fills rows with its head and reports that it is not whole.
The value is read only to find code points and separators; nothing of it is copied, and the rows are offsets into it.
- Parameters
-
Name Direction Meaning value in The secret (UTF-8; need not be NUL-terminated). length in Bytes of valueto break.perRow in Characters a row holds (0 is taken as 1). rows out Caller-owned rows; its size is the row budget.
- Returns
- The rows filled, and whether they hold the whole value.
buildMaskRowUtf8() #
Write count UTF-8 mask bullets into dst, NUL-terminated, bounded.
Emits kMaskGlyphUtf8 (3 bytes) per masked code unit up to whatever fits in dstCap (reserving one byte for the terminator); never writes a partial multi-byte glyph and never overruns dstCap. Only the mask glyph is written — no plaintext is ever copied — so it is masking-equivalent to an asterisk fill.
- Parameters
-
Name Direction Meaning dst out Destination byte buffer (must be non-null when dstCap>0).dstCap in Capacity of dstin bytes (including the NUL terminator).count in Number of mask glyphs requested.
- Returns
- Number of bytes written before the terminator (always <
dstCap).
buildOklabLut() #
Bake an N-entry RGB565 LUT spanning a list of RGB565 stops in OKLab.
Entry i (for i in [0,count)) samples the multi-stop gradient at normalized position i/(count-1): endpoints land exactly on the first / last stop and interior stops are hit at their even fractional positions, with OKLab interpolation between adjacent stops. A single stop fills the LUT with that color; an empty stop list or count < 1 leaves out untouched.
- Parameters
-
Name Direction Meaning stops in RGB565 stop colors (first → last across the gradient). stopCount in Number of stops in stops.out out Destination LUT (filled with countentries).count in Number of LUT entries to write ( outcapacity).
cell() #
Split a rect into count equal cells along axis, with gap.
The classic action-bar / list-row distribution: leftover pixels from integer division are absorbed by the last cell so the track exactly fills track.
- Parameters
-
Name Direction Meaning track in The rect to distribute within. axis in Distribution axis. count in Number of cells (>= 1). gap in Gap in pixels between adjacent cells. index in Cell index in [0, count).
- Returns
- The rect for cell
index, or an empty rect if inputs are invalid.
defaultThemeMode() #
The per-device default mode: Light on e-paper, Dark on color panels.
- Returns
- The default ui::ThemeMode for the active panel type.
easeInOutQuad() #
Quadratic ease-in-out at normalized progress t (clamped to [0,1]).
Accelerates out of the start and decelerates into the target symmetrically (2t^2 for t < 0.5, mirrored after): a smooth, even glide that reads better than ease-out for longer slides (menu scroll, page transitions). Pure, constexpr, endpoints exactly 0 and 1.
- Parameters
-
Name Direction Meaning t in Normalized progress in [0,1] (values outside are clamped).
- Returns
- Eased progress in [0,1].
easeOutBack() #
Ease-out "back" at normalized progress t (clamped to [0,1]).
Decelerates past the target then settles onto it — a subtle spring/
- Parameters
-
Name Direction Meaning t in Normalized progress in [0,1] (values outside are clamped).
- Returns
- Eased progress, ≥0, reaching exactly 1 at
t= 1 (peaks above 1).
easeOutQuad() #
Quadratic ease-out at normalized progress t (clamped to [0,1]).
f(t) = 1 - (1 - t)^2: starts fast and decelerates into the target, the classic "snappy" UI feel. Pure and constexpr.
- Parameters
-
Name Direction Meaning t in Normalized progress in [0,1] (values outside are clamped).
- Returns
- Eased progress in [0,1].
editorSaveRect() #
The Save button that ends an editor's action row.
- Parameters
-
Name Direction Meaning actions in The action row ( TouchEditorRows::).actions
- Returns
- Save's rect, at the right end of
actions.
fontTargetFor() #
Select the physical font targets (0.1 mm) for a density preset.
- Parameters
-
Name Direction Meaning d in Density preset (element-size band).
- Returns
- The physical font targets (0.1 mm) for that density preset.
groupedSecretLength() #
Length groupSecret produces for a value of length characters.
length + (length - 1) / kSecretGroupSize — the value plus one separator per block boundary. Lets a caller size a buffer, or decide whether grouping is affordable, without building the string.
- Parameters
-
Name Direction Meaning length in Secret length in characters.
- Returns
- The grouped length, excluding the terminator.
groupSecret() #
Copy value into out with a space every kSecretGroupSize.
Writes a NUL-terminated string. A value that would not fit cap (including the separators and the terminator) is not grouped: out takes as much of the raw value as fits instead, because a secret cut mid-way by grouping would be worse than an ungrouped one. A trailing separator is never emitted.
- Parameters
-
Name Direction Meaning out out Destination buffer (overwritten; NUL-terminated on return). cap in Capacity of outin bytes, terminator included.value in NUL-terminated secret (nullptr yields an empty result).
- Returns
- Characters written, excluding the terminator.
headerDepthColor565() #
Baked OKLab vertical-depth color for the header bar, top → bottom.
Replaces the flat surface fill of the top chrome bar with a very subtle top-lit → settle fade (a faintly lifted surface at the top easing to the base surface, then a hair toward the page background at the very bottom edge) so the header reads as a raised shelf without a hard divider line or any clutter. Built once on first use (init-time). Color-TFT only — mono / e-paper keep the flat fill + hairline rule and never call this.
- Parameters
-
Name Direction Meaning fraction in Vertical position within the bar, 0.0 (top) → 1.0 (bottom); values outside [0,1] are clamped.
- Returns
- RGB565 fill color for that bar row.
hexGroups() #
Write len bytes as lowercase hex in space-separated groups of groupBytes bytes ("a1b2 c3d4 …").
- Parameters
-
Name Direction Meaning bytes in The key bytes. len in How many bytes to write. groupBytes in Bytes per group (2 gives four hex digits); 0 = one group. out out Text buffer, always NUL-terminated when cap> 0.cap in Size of outin bytes.
- Returns
- Characters written (excluding the NUL); what did not fit is left out.
isTinyScreen() [1/2] #
Runtime helper that queries the active display HAL.
On-device only; prefer the pure isTinyScreen(int16_
- Return values
-
Value Meaning true Active display's smaller dimension is below kTinyScreenDimPx. false Active display is at or above the tiny breakpoint.
- Note
- Reads display dimensions through the
display:: HAL; safe to call from any task context, but the typical caller is the render task (Core 1) where layout decisions are made before drawing.
isTinyScreen() [2/2] #
True when the smaller display dimension is below the tiny breakpoint.
Pure function form for unit tests on the host (no display:: needed).
- Parameters
-
Name Direction Meaning width in Display width in pixels. height in Display height in pixels.
- Return values
-
Value Meaning true min(width, height) is below kTinyScreenDimPx. false min(width, height) is at or above the breakpoint.
layoutEditorCells() #
Lay cells of the given widths across row, left to right, sharing what is left of the row out as equal gaps between them.
- Parameters
-
Name Direction Meaning row in The row to fill. widths in Width of each cell. out out One rect per width (extra entries are left alone).
- Returns
- The gap between two cells (0 with fewer than two cells).
markBodyBounds() #
Every pixel the body, its outline and the keyhole can touch.
A pixel takes ink when its center lies within half a pixel of a shape (the one-pixel coverage ramp), so the box is the outline's outer edge grown by half a pixel. The keyhole stays inside the body at every angle, so the box holds it too.
- Parameters
-
Name Direction Meaning shape in The mark.
- Returns
- The box on the screen (not cut to it).
mmX10ToPxCeil() #
Converts a physical length to panel pixels, rounding up.
Rounding up keeps a floor from shrinking below its physical size.
- Parameters
-
Name Meaning mmX10 Length in 0.1 mm units. ppi Panel density in pixels per inch.
- Returns
- The length in pixels, rounded up.
oklabLerpRgb565() #
Interpolate between two RGB565 colors in OKLab space.
Converts both endpoints sRGB→linear→OKLab, lerps L/a/b by t, then maps the result OKLab→linear→sRGB→RGB565. Pure; uses float math (no double, so the -Wdouble-promotion gate stays clean). Off the render hot path — call it to build a LUT, not per pixel.
- Parameters
-
Name Direction Meaning from in RGB565 color at t= 0.to in RGB565 color at t= 1.t in Blend position in [0,1] (values outside are clamped).
- Returns
- OKLab-interpolated RGB565 color.
paints() #
Whether a repaint that answers no input may paint now.
- Parameters
-
Name Direction Meaning panelAsleep in Whether the panel sleeps ( display::).isAsleep
- Return values
-
Value Meaning true The panel is awake. false The panel sleeps: paint nothing, and keep the repaint pending.
place() #
Place rows top to bottom in the band from top to bottom.
- Parameters
-
Name Direction Meaning rows in The rows, top to bottom, their design offsets ascending. top in First pixel row of the band. bottom in Pixel row the band ends before (exclusive). tops out Receives each row's top; must hold at least rows.size().
- Return values
-
Value Meaning true Every row lies inside the band. false The rows alone are taller than the band: they are stacked from topwith no gap and run pastbottom. Also false, with nothing written, whentopsis shorter thanrows.
raiseFontToFloor() #
Raise each font role to at least the matching floor.
- Parameters
-
Name Direction Meaning f in Resolved per-role pixel sizes. floor in Per-role minimum sizes.
- Returns
fwith every role clamped up tofloor(element-wise max).
readableDetail() #
The role for secondary text the owner reads in order to act.
A setting's value, a status tag, the line under an empty tab: on a 1-bit panel and on the roomy 320x240 boards these take the body size, because the small rung there falls below the 16 arcmin legibility floor (a 9 px cap reads at about 13 arcmin on a Core); the compact color panels keep the small role. Counters and badges are not read to act and stay small everywhere.
- Parameters
-
Name Direction Meaning layout in Responsive context.
- Returns
- BODY on a monochrome or roomy panel, SMALL elsewhere.
refViewDistanceFor() #
Reference viewing distance of density band d (0.1 mm units).
- Parameters
-
Name Direction Meaning d in Density preset.
- Returns
- The distance the band's physical-mm targets were tuned at.
resolveMetrics() #
Resolve the full per-device pixel metrics for a profile's geometry.
The single entry point that turns (density, ppi, minor-dimension) into the concrete pixel font + spacing scales components use. PPI-resolved then budget-clamped per resolvePx.
- Parameters
-
Name Direction Meaning d in Density preset (element-size band). ppi in Panel pixels-per-inch. minorDimPx in Shorter (effective) panel dimension in pixels.
- Returns
- Resolved, clamped pixel metrics.
resolvePx() #
Resolve a physical target (0.1 mm) to a clamped pixel size.
px = round(target_
- Parameters
-
Name Direction Meaning targetMmX10 in Physical target in 0.1 mm units. ppi in Panel pixels-per-inch. minorDimPx in Shorter panel dimension in pixels (the budget anchor). cap in Budget cap (fraction of minorDimPx) for this role.
- Returns
- The PPI-resolved, budget-clamped pixel size (>= 1).
roundUpToGrid() #
Rounds a pixel length up to the next multiple of a grid step.
- Parameters
-
Name Meaning px Length in pixels. grid Grid step in pixels; 0 or less leaves pxunchanged.
- Returns
pxrounded up to a multiple ofgrid.
secretLines() #
Rows a monospace secret takes in a given width, and whether to group it.
In a monospace face the wrapped row count follows from the length alone, so this needs no measurement of the secret itself — only the advance of the face it will be drawn in. That keeps the characters out of the layout pass entirely.
Grouping is applied only when it is free: the separators widen the value, and a reader is better served by an ungrouped secret on one row than a grouped one spilling onto a second. charsPerRow counts characters of the secret, not of the grouped form, and is a whole number of blocks when grouping applies — so a caller slices the raw value and groups each row, and no row ever begins or ends inside a block.
- Parameters
-
Name Direction Meaning length in Secret length in characters. widthPx in Row width available, in pixels. advancePx in Advance of one character in the monospace face.
- Returns
- The row count and whether the grouped form fits in it.
segmentPillX() #
Left-edge X of the active pill for segment index index.
The pill is centered within its segment: trackX + index*segW + (segW-pillW)/
- Parameters
-
Name Direction Meaning g in Resolved geometry from tabIndicatorGeometry. index in Active segment index (0-based; not bounds-checked here — the caller passes a valid page index).
- Returns
- Pill left-edge X in pixels.
selectionBandColor565() #
Baked OKLab vertical-depth color for a selection band, top → bottom.
Gives the menu/dropdown selection band a subtle top-lit sheen instead of a flat accent fill: the top edge is a faintly lifted accent and the bottom edge is the base accent token, so the highlighted row reads with a little depth without introducing clutter or a second hue. The LUT is built once on first use (init-time, not per frame). Color-TFT only — mono / e-paper callers keep the flat ink fill and never call this.
- Parameters
-
Name Direction Meaning fraction in Vertical position within the band, 0.0 (top) → 1.0 (bottom); values outside [0,1] are clamped.
- Returns
- RGB565 fill color for that band row.
setThemeMode() #
Set, persist (NVS), and apply the theme mode. The caller should request a full screen redraw afterwards so the new polarity is rendered.
- Parameters
-
Name Direction Meaning mode in The new theme mode.
- Return values
-
Value Meaning true The mode is applied and stored. false The mode is applied to the live display but was not stored (no NVS, or the write did not land): the panel shows the new polarity and the next boot shows the old one, so a surface must not report the change saved. Always true off-target.
spaceTargetFor() #
Select the physical spacing targets (0.1 mm) for a density preset.
- Parameters
-
Name Direction Meaning d in Density preset (element-size band).
- Returns
- The physical spacing targets (0.1 mm) for that density preset.
split() #
Carve a fixed-size band off one edge of track, return the rest.
The header/footer split primitive: e.g. reserve a header of size px off the top, leaving the body. The reserved band is written to band.
- Parameters
-
Name Direction Meaning track in The rect to split. axis in Split axis (Horizontal carves a left band). size in Band thickness in pixels. fromStart in True to carve from the start edge (top/left), else end. band out Receives the carved band rect.
- Returns
- The remaining rect after the band (and no gap) is removed.
tabIconStripGeometry() #
Compute the icon-tab-strip underline geometry for a content width.
Full-width strip (no side inset): each of the segments cells spans width / segments, and the underline pill covers the middle kTabUnderlineWidthNum / kTabUnderlineWidthDen of its cell so adjacent cells read as separate stops. The pill's per-segment left edge comes from segmentPillX, which is what the slide tween animates between.
- Parameters
-
Name Direction Meaning width in Panel/content width in pixels. segments in Number of tab cells (>= 1).
- Returns
- Resolved geometry; zero-sized when
segmentsis zero orwidthis not positive.
tabIndicatorGeometry() #
Compute the segmented indicator geometry for a given content width.
- Parameters
-
Name Direction Meaning width in Panel/content width in pixels. insetX in Horizontal inset applied on each side (e.g. the medium spacing step). pillInsetX in Inset subtracted from a segment to form the pill width (e.g. space.xs), so adjacent pills read as separate. segments in Number of page segments (>= 1).
- Returns
- Resolved geometry; zero-sized when
widthis too small orsegmentsis zero.
themeIsLight() #
- Returns
- True when the active mode is ui::
ThemeMode:: Light.
themeMode() #
The active theme mode (the persisted value, or the default before init).
- Returns
- The currently applied ui::ThemeMode.
toRgb565() #
Compile-time conversion from a 24-bit RGB color to 16-bit RGB565.
- Parameters
-
Name Direction Meaning c in 24-bit color in 0xRRGGBB format.
- Returns
- 16-bit RGB565 representation.
touchEditorRows() #
The editor's rows under a header headerH tall, full width less the small gap on both sides, one tap target tall, one small gap apart.
- Parameters
-
Name Direction Meaning layout in Responsive context. headerH in Height of the header the rows sit under.
- Returns
- The three rows.
Variable Documentation
kCapLarge #
large <= minorDim * 3/8 (headline).
kCapSpace #
Spacing values are capped to keep at least a usable content band on tiny panels.
any single gap <= minorDim / 4.
kCoreTouchCozyRow #
The vault row of the Core2 v1.3 and the CoreS3 SE: their header is the 40 px tap floor on every screen, and 44 px rows (over the same floor) keep three vault rows in the band that leaves between the tab strip and the zone shelf.
kEditorSaveW #
Width of the Save button that ends an editor's action row: a one-word verb in the longest locale, three tap floors wide.
kEntryRevealAutoHideMs #
How long a value unmasked on a text-entry surface (the touch PIN / passphrase entry, the touch text editor) stays in the clear before it masks itself (ms). The reveal is a latching toggle, and a panel retains its last frame in RAM while the backlight is off: without the limit, a secret revealed just before the idle screen-off would be lit again, in the clear, for whoever wakes the device next. Long enough to read a passphrase back, short enough that walking away does not leave it showing.
kEpaperActionBarPx #
The CoreInk's action-bar shelf: a 14 px caption with room under it for the 2 px hold rule. The physical model resolves 15 px, which leaves none.
kEpaperBands #
The CoreInk's list bands: 24 px vault rows, so the vault keeps five rows between the tab strip and the 20 px shelf, and 26 px menu rows, which leave the settings lists a band under their fifth row for the "more" cue. The header keeps the model's height.
kSecretGroupSize #
Characters per visual block. Five keeps a 20-character key to four blocks and matches the grouping a reader is used to on a license key or a backup code.
kSecretMaxRows #
Rows a caller sizes its SecretRow buffer to: a 128-character password (the vault's longest) at eight characters a row, narrower than any panel gives a revealed password.
kSelectionBandEntries #
Entry count of the baked selection-band depth LUT (top → bottom of a row). 9 entries is finer than the eye resolves over a single ~24 px list row.
kSpinMs #
motion.spin: one turn of the verify wait's segment, the one ring that turns (ms). The indeterminate progress card (popup::
kSubtle #
Row dividers, borders.
kTabTrackGap #
Vertical gap between the indicator track and the first list row, so the pager does not kiss the header baseline or the list.
kTabTrackH #
Pill / track height in pixels (the moving active-segment bar). At 4 px it clears the ≥3:1 non-text visibility floor and reads as a page indicator rather than a 1 px title underline.