Kleidos API Search

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/ui/core/animation.h
Time-based value tween for fluid UI transitions (host-testable).
file src/ui/core/canvas.h
The single drawing-backend seam for the in-house UI library.
file src/ui/core/column_flow.h
Where the rows of a column land in the band its screen has for it.
file src/ui/core/device_profile.h
Orthogonal device-capability model for the responsive UI layer.
file src/ui/core/gradient.h
Perceptually-uniform (OKLab) RGB565 gradient stop-LUTs.
file src/ui/core/key_text.h
Key bytes as text a person can read back: hex in groups and base64.
file src/ui/core/layout.h
Display-size heuristics shared by popups and panels.
file src/ui/core/layout_context.h
Responsive layout seam: a kleidos::ui::DeviceProfile + safe insets + flex/box.
file src/ui/core/mark_shape.h
The Kleidos mark's body and keyhole in sub-pixel units, as a color canvas draws them.
file src/ui/core/mask_glyph.h
Password-mask glyph and a bounded UTF-8 mask-row builder (host-testable).
file src/ui/core/reveal_window.h
How long an unmasked secret stays on screen before it hides itself. Pure, host-testable.
file src/ui/core/screen_painter.h
Central dirty-only repaint driver for every screen.
file src/ui/core/secret_group.h
Visual grouping for a secret the user has to copy out by hand.
file src/ui/core/sleeping_panel.h
What a screen paints on its own clock while the panel sleeps: nothing.
file src/ui/core/tab_indicator.h
Segmented page-indicator geometry + slide timing (host-testable).
file src/ui/core/text_role.h
Text roles chosen by what the text is for, resolved per panel.
file src/ui/core/theme.h
Unified color theme for all device variants (RGB24 + RGB565).
file src/ui/core/theme_mode.h
Runtime light/dark theme selection (persisted), applied to the display.
file src/ui/core/tokens.h
Consolidated design tokens (color + spacing + radius + typography).
file src/ui/core/touch_editor_layout.h
Row geometry of a value editor on the touch-control boards. Pure, host-testable.

Namespaces

namespace kleidos::ui::mark_shape_detail
Integer helpers of a MarkBodyShape, for pixel boxes from sub-pixel lengths.
namespace kleidos::ui::tokens::motion
Motion tokens: the timings every surface shares (the design system's "motion").

Classes

class kleidos::ui::Tween
Interpolates a scalar from a start to a target over a duration. More about kleidos::ui::Tween
class kleidos::ui::Canvas
Abstract immediate-mode drawing surface. More about kleidos::ui::Canvas
struct kleidos::ui::column_flow::Row
One row of the column. More about kleidos::ui::column_flow::Row
struct kleidos::ui::Capabilities
Physical input affordance of the device. More about kleidos::ui::Capabilities
struct kleidos::ui::DeviceProfile
Orthogonal description of a target device's UI-relevant traits. More about kleidos::ui::DeviceProfile
struct kleidos::ui::Rect
Integer rectangle in screen space (top-left origin, pixels). More about kleidos::ui::Rect
struct kleidos::ui::SafeInsets
Safe-area insets in pixels (content margins from the screen edge). More about kleidos::ui::SafeInsets
class kleidos::ui::LayoutContext
Per-screen responsive context, derived from a DeviceProfile. More about kleidos::ui::LayoutContext
struct kleidos::ui::MarkBodyShape
The mark's body and keyhole, centered on the center of pixel (cx, cy). More about kleidos::ui::MarkBodyShape
struct kleidos::ui::MarkBodyInks
The inks of a MarkBodyShape, RGB565. More about kleidos::ui::MarkBodyInks
class kleidos::ui::RevealWindow
The open-for-a-while window of one unmasked secret. More about kleidos::ui::RevealWindow
struct kleidos::ui::Circle
A circular section, addressed by its bounding square for invalidation. More about kleidos::ui::Circle
class kleidos::ui::ScreenPainter
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::ui::ScreenPainter
struct kleidos::ui::SecretLayout
How a secret of a given length lays out in a monospace row (secretLines). More about kleidos::ui::SecretLayout
struct kleidos::ui::SecretRow
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::ui::SecretRow
struct kleidos::ui::SecretBreak
What breakSecret filled. More about kleidos::ui::SecretBreak
class kleidos::ui::sleeping_panel::StaleGuard
Keeps a value that is wrong once stale off a sleeping panel. More about kleidos::ui::sleeping_panel::StaleGuard
struct kleidos::ui::TabIndicatorGeometry
Resolved horizontal layout for the segmented tab indicator. More about kleidos::ui::TabIndicatorGeometry
struct kleidos::ui::TextRole
A text role and the pixel size it lays out at. More about kleidos::ui::TextRole
struct kleidos::ui::tokens::SpaceScale
Spacing scale in pixels (xs..xl + action-bar shelf), per density. More about kleidos::ui::tokens::SpaceScale
struct kleidos::ui::tokens::FontScale
Per-role target text height in pixels, per density (resolved by PPI). More about kleidos::ui::tokens::FontScale
struct kleidos::ui::tokens::RadiusScale
Corner-radius scale in pixels, the design system's radius. More about kleidos::ui::tokens::RadiusScale
struct kleidos::ui::tokens::Bands
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::ui::tokens::Bands
struct kleidos::ui::tokens::Metrics
Resolved per-device pixel metrics (font + spacing) for one profile. More about kleidos::ui::tokens::Metrics
struct kleidos::ui::tokens::BudgetCap
Numerator/denominator of the minor-dimension budget cap, per role. More about kleidos::ui::tokens::BudgetCap
struct kleidos::ui::TouchEditorRows
The three rows of a touch value editor. More about kleidos::ui::TouchEditorRows

Enumerations

enum class kleidos::ui::Easing : uint8_t { kleidos::ui::Easing::OutQuad , kleidos::ui::Easing::InOutQuad , kleidos::ui::Easing::OutBack }
Selectable easing curve applied by a Tween. More about kleidos::ui::Easing
enum class kleidos::ui::Orientation : uint8_t { kleidos::ui::Orientation::Portrait , kleidos::ui::Orientation::Landscape , kleidos::ui::Orientation::Square }
Screen arrangement axis — drives how a screen lays things out. More about kleidos::ui::Orientation
enum class kleidos::ui::ColorMode : uint8_t { kleidos::ui::ColorMode::Rgb565 , kleidos::ui::ColorMode::Grayscale , kleidos::ui::ColorMode::Mono1 }
Color capability of the panel. More about kleidos::ui::ColorMode
enum class kleidos::ui::Refresh : uint8_t { kleidos::ui::Refresh::Instant , kleidos::ui::Refresh::Epaper }
Refresh behavior of the panel. More about kleidos::ui::Refresh
enum class kleidos::ui::Nav : uint8_t { kleidos::ui::Nav::Vertical , kleidos::ui::Nav::Planar , kleidos::ui::Nav::DirectTap }
Focus-movement semantics — what navigation means on this device. More about kleidos::ui::Nav
enum class kleidos::ui::flex::Axis : uint8_t { Axis::Horizontal , Axis::Vertical }
Axis a track distributes along. More about kleidos::ui::flex::Axis
enum class kleidos::ui::sleeping_panel::StaleStep : uint8_t { kleidos::ui::sleeping_panel::StaleStep::Live , kleidos::ui::sleeping_panel::StaleStep::Hide , kleidos::ui::sleeping_panel::StaleStep::Hold , kleidos::ui::sleeping_panel::StaleStep::Restore }
What a screen does this tick with a value that is wrong once stale. More about kleidos::ui::sleeping_panel::StaleStep
enum class kleidos::ui::ThemeMode : uint8_t { kleidos::ui::ThemeMode::Light , kleidos::ui::ThemeMode::Dark }
User-selectable UI theme polarity. More about kleidos::ui::ThemeMode
enum class kleidos::ui::tokens::Density : uint8_t { kleidos::ui::tokens::Density::Compact , kleidos::ui::tokens::Density::Roomy }
UI density preset — the element-SIZE axis (spacing + font role target). More about kleidos::ui::tokens::Density

Functions

constexpr floatkleidos::ui::easeOutQuad (float t)
Quadratic ease-out at normalized progress t (clamped to [0,1]).
constexpr floatkleidos::ui::easeInOutQuad (float t)
Quadratic ease-in-out at normalized progress t (clamped to [0,1]).
constexpr floatkleidos::ui::easeOutBack (float t)
Ease-out "back" at normalized progress t (clamped to [0,1]).
constexpr floatkleidos::ui::applyEasing (Easing easing, float t)
Evaluate a named easing curve at normalized progress t.
constexpr boolkleidos::ui::column_flow::place (std::span< const Row > rows, int16_t top, int16_t bottom, std::span< int16_t > tops)
Place rows top to bottom in the band from top to bottom.
uint16_tkleidos::ui::gradient::oklabLerpRgb565 (uint16_t from, uint16_t to, float t)
Interpolate between two RGB565 colors in OKLab space.
voidkleidos::ui::gradient::buildOklabLut (const uint16_t *stops, std::size_t stopCount, uint16_t *out, std::size_t count)
Bake an N-entry RGB565 LUT spanning a list of RGB565 stops in OKLab.
uint16_tkleidos::ui::gradient::selectionBandColor565 (float fraction)
Baked OKLab vertical-depth color for a selection band, top → bottom.
uint16_tkleidos::ui::gradient::headerDepthColor565 (float fraction)
Baked OKLab vertical-depth color for the header bar, top → bottom.
std::size_tkleidos::ui::key_text::hexGroups (const uint8_t *bytes, std::size_t len, std::size_t groupBytes, char *out, std::size_t cap)
Write len bytes as lowercase hex in space-separated groups of groupBytes bytes ("a1b2 c3d4 …").
std::size_tkleidos::ui::key_text::base64 (const uint8_t *bytes, std::size_t len, char *out, std::size_t cap)
Write len bytes as standard base64 (RFC 4648, with padding).
constexpr boolkleidos::ui::isTinyScreen (int16_t width, int16_t height)
True when the smaller display dimension is below the tiny breakpoint.
boolkleidos::ui::isTinyScreen ()
Runtime helper that queries the active display HAL.
constexpr Rectkleidos::ui::flex::cell (const Rect &track, Axis axis, int16_t count, int16_t gap, int16_t index)
Split a rect into count equal cells along axis, with gap.
constexpr Rectkleidos::ui::flex::split (const Rect &track, Axis axis, int16_t size, bool fromStart, Rect &band)
Carve a fixed-size band off one edge of track, return the rest.
constexpr Rectkleidos::ui::markBodyBounds (const MarkBodyShape &shape)
Every pixel the body, its outline and the keyhole can touch.
std::size_tkleidos::ui::buildMaskRowUtf8 (char *dst, std::size_t dstCap, std::size_t count)
Write count UTF-8 mask bullets into dst, NUL-terminated, bounded.
std::size_tkleidos::ui::groupSecret (char *out, std::size_t cap, const char *value)
Copy value into out with a space every kSecretGroupSize.
constexpr std::size_tkleidos::ui::groupedSecretLength (std::size_t length)
Length groupSecret produces for a value of length characters.
SecretLayoutkleidos::ui::secretLines (std::size_t length, int16_t widthPx, int16_t advancePx)
Rows a monospace secret takes in a given width, and whether to group it.
SecretBreakkleidos::ui::breakSecret (const char *value, std::size_t length, std::size_t perRow, std::span< SecretRow > rows)
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 boolkleidos::ui::sleeping_panel::paints (bool panelAsleep)
Whether a repaint that answers no input may paint now.
constexpr TabIndicatorGeometrykleidos::ui::tabIndicatorGeometry (int16_t width, int16_t insetX, int16_t pillInsetX, uint8_t segments)
Compute the segmented indicator geometry for a given content width.
constexpr TabIndicatorGeometrykleidos::ui::tabIconStripGeometry (int16_t width, uint8_t segments)
Compute the icon-tab-strip underline geometry for a content width.
constexpr int16_tkleidos::ui::segmentPillX (const TabIndicatorGeometry &g, uint8_t index)
Left-edge X of the active pill for segment index index.
constexpr TextRolekleidos::ui::readableDetail (const LayoutContext &layout)
The role for secondary text the owner reads in order to act.
constexpr uint16_tkleidos::ui::theme::toRgb565 (uint32_t c)
Compile-time conversion from a 24-bit RGB color to 16-bit RGB565.
ThemeModekleidos::ui::defaultThemeMode ()
The per-device default mode: Light on e-paper, Dark on color panels.
ThemeModekleidos::ui::themeMode ()
The active theme mode (the persisted value, or the default before init).
boolkleidos::ui::themeIsLight ()
voidkleidos::ui::initThemeMode ()
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.
boolkleidos::ui::setThemeMode (ThemeMode mode)
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_tkleidos::ui::tokens::refViewDistanceFor (Density d)
Reference viewing distance of density band d (0.1 mm units).
constexpr int16_tkleidos::ui::tokens::mmX10ToPxCeil (int16_t mmX10, int16_t ppi)
Converts a physical length to panel pixels, rounding up.
constexpr int16_tkleidos::ui::tokens::roundUpToGrid (int16_t px, int16_t grid)
Rounds a pixel length up to the next multiple of a grid step.
constexpr FontScalekleidos::ui::tokens::raiseFontToFloor (const FontScale &f, const FontScale &floor)
Raise each font role to at least the matching floor.
constexpr int16_tkleidos::ui::tokens::resolvePx (int16_t targetMmX10, int16_t ppi, int16_t minorDimPx, const BudgetCap &cap)
Resolve a physical target (0.1 mm) to a clamped pixel size.
constexpr const FontScale &kleidos::ui::tokens::fontTargetFor (Density d)
Select the physical font targets (0.1 mm) for a density preset.
constexpr const SpaceScale &kleidos::ui::tokens::spaceTargetFor (Density d)
Select the physical spacing targets (0.1 mm) for a density preset.
constexpr Metricskleidos::ui::tokens::resolveMetrics (Density d, int16_t ppi, int16_t minorDimPx)
Resolve the full per-device pixel metrics for a profile's geometry.
constexpr TouchEditorRowskleidos::ui::touchEditorRows (const LayoutContext &layout, int16_t headerH)
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 Rectkleidos::ui::editorSaveRect (const Rect &actions)
The Save button that ends an editor's action row.
constexpr int16_tkleidos::ui::layoutEditorCells (const Rect &row, std::span< const int16_t > widths, std::span< Rect > out)
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_tkleidos::ui::kMenuAnimMs
Default tween duration (ms): snappy menu-scroll / highlight slide.
constexpr floatkleidos::ui::kBackOvershoot
Overshoot strength for easeOutBack (the classic back-ease constant).
constexpr std::size_tkleidos::ui::gradient::kSelectionBandEntries
constexpr std::size_tkleidos::ui::gradient::kHeaderDepthEntries
Entry count of the baked header-depth LUT (top → bottom of the header bar).
constexpr int16_tkleidos::ui::kTinyScreenDimPx
Threshold below which a screen is considered "tiny". Keep this aligned with the smallest panel the design system draws for.
constexpr int32_tkleidos::ui::kMarkSubPx
Sub-pixel steps per pixel of a MarkBodyShape length.
constexpr int32_tkleidos::ui::kMarkDirScale
The scale of MarkBodyShape::stemDirX and MarkBodyShape::stemDirY (a unit vector).
constexpr char32_tkleidos::ui::kMaskGlyph
Canonical password-mask code point: U+2022 BULLET (atlas-confirmed).
constexpr const char *kleidos::ui::kMaskGlyphUtf8
UTF-8 encoding of kMaskGlyph (0xE2 0x80 0xA2), NUL-terminated.
constexpr std::size_tkleidos::ui::kMaskGlyphUtf8Len
Bytes the bullet occupies in UTF-8 (3) — size mask buffers as count * 3 + 1.
constexpr const char *kleidos::ui::kMaskGlyphFallbackMidDot
First documented fallback: U+00B7 MIDDLE DOT (·), UTF-8 0xC2 0xB7.
constexpr charkleidos::ui::kMaskGlyphAscii
Last-resort fallback: ASCII * (U+002A), single byte.
constexpr uint32_tkleidos::ui::kEntryRevealAutoHideMs
constexpr std::size_tkleidos::ui::kSecretGroupSize
constexpr std::size_tkleidos::ui::kSecretMaxRows
constexpr int16_tkleidos::ui::kTabTrackH
constexpr int16_tkleidos::ui::kTabTrackGap
constexpr uint32_tkleidos::ui::kTabSlideMs
Active-pill slide duration in ms when switching pages (Refresh::Instant only).
constexpr int16_tkleidos::ui::kTabStripH
Icon tab strip band height in pixels (icons + underline).
constexpr int16_tkleidos::ui::kTabIconPx
Tab icon edge in pixels (drawn centered in each cell).
constexpr int16_tkleidos::ui::kTabUnderlineH
Active-cell underline thickness in pixels.
constexpr int16_tkleidos::ui::kTabUnderlineWidthNum
Numerator of the underline-width fraction of a cell (56 % of the cell).
constexpr int16_tkleidos::ui::kTabUnderlineWidthDen
Denominator of the underline-width fraction of a cell.
constexpr uint32_tkleidos::ui::theme::kBg
Pure black background.
constexpr uint32_tkleidos::ui::theme::kSurface
Cards, panels, headers.
constexpr uint32_tkleidos::ui::theme::kElevated
Raised interactive key face.
constexpr uint32_tkleidos::ui::theme::kAccent
Selected / focus highlight.
constexpr uint32_tkleidos::ui::theme::kPrimary
Cyan — CTA, titles, cursor.
constexpr uint32_tkleidos::ui::theme::kText
Primary text.
constexpr uint32_tkleidos::ui::theme::kTextSec
Secondary / hint text.
constexpr uint32_tkleidos::ui::theme::kWarning
Red — error, delete.
constexpr uint32_tkleidos::ui::theme::kSuccess
Green — OK, connected.
constexpr uint32_tkleidos::ui::theme::kLockout
Yellow — lockout, caution.
constexpr uint32_tkleidos::ui::theme::kInfo
Orange — WiFi, info.
constexpr uint32_tkleidos::ui::theme::kMuted
Dark gray — dim tracks, versions.
constexpr uint32_tkleidos::ui::theme::kSubtle
Row dividers, inactive track borders.
constexpr uint32_tkleidos::ui::theme::kSuccessFill
Success container fill.
constexpr uint32_tkleidos::ui::theme::kWarningFill
Alert / destructive container fill.
constexpr uint32_tkleidos::ui::theme::kWarningTitle
Destructive popup title bar.
constexpr uint32_tkleidos::ui::theme::kCautionTitle
Caution popup title bar.
constexpr uint32_tkleidos::ui::theme::kTileIndigo
Letter tile fill: indigo.
constexpr uint32_tkleidos::ui::theme::kTileViolet
Letter tile fill: violet.
constexpr uint32_tkleidos::ui::theme::kTileGrape
Letter tile fill: grape.
constexpr uint32_tkleidos::ui::theme::kTilePink
Letter tile fill: pink.
constexpr uint32_tkleidos::ui::theme::kTileSlate
Letter tile fill: slate.
constexpr uint16_tkleidos::ui::theme::kBg565
Pre-computed RGB565 for kBg.
constexpr uint16_tkleidos::ui::theme::kSurface565
Pre-computed RGB565 for kSurface.
constexpr uint16_tkleidos::ui::theme::kElevated565
Pre-computed RGB565 for kElevated.
constexpr uint16_tkleidos::ui::theme::kAccent565
Pre-computed RGB565 for kAccent.
constexpr uint16_tkleidos::ui::theme::kPrimary565
Pre-computed RGB565 for kPrimary.
constexpr uint16_tkleidos::ui::theme::kText565
Pre-computed RGB565 for kText.
constexpr uint16_tkleidos::ui::theme::kTextSec565
Pre-computed RGB565 for kTextSec.
constexpr uint16_tkleidos::ui::theme::kWarning565
Pre-computed RGB565 for kWarning.
constexpr uint16_tkleidos::ui::theme::kSuccess565
Pre-computed RGB565 for kSuccess.
constexpr uint16_tkleidos::ui::theme::kLockout565
Pre-computed RGB565 for kLockout.
constexpr uint16_tkleidos::ui::theme::kInfo565
Pre-computed RGB565 for kInfo.
constexpr uint16_tkleidos::ui::theme::kMuted565
Pre-computed RGB565 for kMuted.
constexpr uint16_tkleidos::ui::theme::kSubtle565
Pre-computed RGB565 for kSubtle.
constexpr uint16_tkleidos::ui::theme::kSuccessFill565
Pre-computed RGB565 for kSuccessFill.
constexpr uint16_tkleidos::ui::theme::kWarningFill565
Pre-computed RGB565 for kWarningFill.
constexpr uint16_tkleidos::ui::theme::kWarningTitle565
Pre-computed RGB565 for kWarningTitle.
constexpr uint16_tkleidos::ui::theme::kCautionTitle565
Pre-computed RGB565 for kCautionTitle.
constexpr uint16_tkleidos::ui::theme::kTileIndigo565
Pre-computed RGB565 for kTileIndigo.
constexpr uint16_tkleidos::ui::theme::kTileViolet565
Pre-computed RGB565 for kTileViolet.
constexpr uint16_tkleidos::ui::theme::kTileGrape565
Pre-computed RGB565 for kTileGrape.
constexpr uint16_tkleidos::ui::theme::kTilePink565
Pre-computed RGB565 for kTilePink.
constexpr uint16_tkleidos::ui::theme::kTileSlate565
Pre-computed RGB565 for kTileSlate.
constexpr uint16_tkleidos::ui::tokens::color::kBg
Pure black background.
constexpr uint16_tkleidos::ui::tokens::color::kSurface
Cards, panels, headers.
constexpr uint16_tkleidos::ui::tokens::color::kElevated
Raised interactive key face.
constexpr uint16_tkleidos::ui::tokens::color::kAccent
Selected / focus row fill.
constexpr uint16_tkleidos::ui::tokens::color::kPrimary
Cyan — CTA, titles, cursor.
constexpr uint16_tkleidos::ui::tokens::color::kText
Primary text.
constexpr uint16_tkleidos::ui::tokens::color::kTextSec
Secondary / hint text.
constexpr uint16_tkleidos::ui::tokens::color::kWarning
Red — error, delete.
constexpr uint16_tkleidos::ui::tokens::color::kSuccess
Green — OK, connected.
constexpr uint16_tkleidos::ui::tokens::color::kLockout
Yellow — lockout, caution.
constexpr uint16_tkleidos::ui::tokens::color::kInfo
Orange — WiFi, info.
constexpr uint16_tkleidos::ui::tokens::color::kMuted
Dark gray — dim tracks.
constexpr uint16_tkleidos::ui::tokens::color::kSubtle
constexpr uint16_tkleidos::ui::tokens::color::kSuccessFill
Success container fill — a light foreground sits on this, never on kSuccess.
constexpr uint16_tkleidos::ui::tokens::color::kWarningFill
Alert / destructive container fill — same contract as kSuccessFill.
constexpr uint16_tkleidos::ui::tokens::color::kWarningTitle
Destructive popup title bar — light text sits on it.
constexpr uint16_tkleidos::ui::tokens::color::kCautionTitle
Caution popup title bar — light text sits on it.
constexpr uint16_tkleidos::ui::tokens::color::kTileIndigo
Letter-tile fills (color.tile.*): no status hue and not the focus cyan.
constexpr uint16_tkleidos::ui::tokens::color::kTileViolet
Letter-tile fill: violet.
constexpr uint16_tkleidos::ui::tokens::color::kTileGrape
Letter-tile fill: grape.
constexpr uint16_tkleidos::ui::tokens::color::kTilePink
Letter-tile fill: pink.
constexpr uint16_tkleidos::ui::tokens::color::kTileSlate
Letter-tile fill: slate.
constexpr uint32_tkleidos::ui::tokens::motion::kFadeMs
motion.fade: the one transition length every surface shares (ms).
constexpr uint32_tkleidos::ui::tokens::motion::kLongPressMs
motion.longpress: how long a press lasts before it counts as a hold (ms).
constexpr uint32_tkleidos::ui::tokens::motion::kSpinMs
constexpr int16_tkleidos::ui::tokens::kCompactRefPpi
PPI of the reference panel whose tuned px define the Compact band (the Sticks').
constexpr int16_tkleidos::ui::tokens::kCompactRefViewMmX10
Viewing distance the Compact band's tuned px assume (a Stick at the wrist).
constexpr int16_tkleidos::ui::tokens::kRoomyRefViewMmX10
Viewing distance the Roomy band's tuned px assume (a 320×240 board on the desk).
constexpr int16_tkleidos::ui::tokens::kRoomyRefPpi
PPI of the reference device whose tuned px define the Roomy band (three-button).
constexpr RadiusScalekleidos::ui::tokens::kRadius
Radius scale is density-independent.
constexpr int16_tkleidos::ui::tokens::kTapRowMmX10
Row / band floor, 0.1 mm.
constexpr int16_tkleidos::ui::tokens::kTapHitMmX10
Isolated hit-box floor, 0.1 mm.
constexpr int32_tkleidos::ui::tokens::kMmX10PerInch
One inch in 0.1 mm units.
constexpr int16_tkleidos::ui::tokens::kEpaperActionBarPx
constexpr Bandskleidos::ui::tokens::kEpaperBands
constexpr int16_tkleidos::ui::tokens::kCoreTouchCozyRow
constexpr FontScalekleidos::ui::tokens::kCardputerSheetFont
The M5Cardputer ADV's type ladder (small, body, heading, large, mono).
constexpr Bandskleidos::ui::tokens::kCardputerSheetBands
The M5Cardputer ADV's fixed bands: header, vault row, menu row.
constexpr BudgetCapkleidos::ui::tokens::kCapSmall
small <= minorDim / 6.
constexpr BudgetCapkleidos::ui::tokens::kCapBody
body <= minorDim / 5.
constexpr BudgetCapkleidos::ui::tokens::kCapMono
mono <= minorDim / 5.
constexpr BudgetCapkleidos::ui::tokens::kCapHeading
heading <= minorDim / 4.
constexpr BudgetCapkleidos::ui::tokens::kCapLarge
constexpr BudgetCapkleidos::ui::tokens::kCapSpace
Spacing values are capped to keep at least a usable content band on tiny panels.
constexpr int16_tkleidos::ui::kEditorSaveW

Back to the top

Enumeration Type Documentation

Axis #

enum class kleidos::ui::flex::Axis : uint8_t

Axis a track distributes along.

Enumerator
Horizontal 

Children laid left-to-right; track shares width.

Vertical 

Children laid top-to-bottom; track shares height.

ColorMode #

enum class kleidos::ui::ColorMode : uint8_t

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.

Enumerator
Rgb565 

16-bit color TFT (every board but the CoreInk).

Grayscale 

Multi-level gray (no board has one).

Mono1 

1-bit ink/paper (the CoreInk's e-paper).

Density #

enum class kleidos::ui::tokens::Density : uint8_t

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::DeviceProfile (a physically small panel is Compact even at 200 px, which is how the CoreInk resolves) — not from a pixel breakpoint alone.

Enumerator
Compact 

Physically small panels (the Sticks, M5Cardputer ADV, CoreInk). Tight, small.

Roomy 

Physically large panels (Core2 v1.3, CoreS3 SE, LILYGO T-Deck). Generous, larger.

Easing #

enum class kleidos::ui::Easing : uint8_t

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.

Enumerator
OutQuad 

Fast start, gentle settle (default; snappy).

InOutQuad 

Symmetric accel + decel (smooth glide; longer slides).

OutBack 

Overshoot past then settle (selection snap / spring-lite).

Nav #

enum class kleidos::ui::Nav : uint8_t

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.

Enumerator
Vertical 

Linear up/down focus through a column (keys, touch zones, the CoreInk's dial).

Planar 

2-D / shortcut-driven (keyboard arrows and tabs: the M5Cardputer ADV).

DirectTap 

Point-and-tap anywhere (the LILYGO T-Deck's trackball and touch).

Orientation #

enum class kleidos::ui::Orientation : uint8_t

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::withOrientation. Orthogonal to density: a Compact device may be Portrait (the Sticks) or Landscape (the M5Cardputer ADV).

Enumerator
Portrait 

Taller than wide (the Sticks: 135×240). Vertical column layouts.

Landscape 

Wider than tall (the 240×135 and 320×240 panels). Row / planar layouts.

Square 

Within a small tolerance of 1:1 (the CoreInk's 200×200).

Refresh #

enum class kleidos::ui::Refresh : uint8_t

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.

Enumerator
Instant 

Fast TFT redraw; animations allowed.

Epaper 

Slow electrophoretic refresh; reduce-motion, batch one commit.

StaleStep #

enum class kleidos::ui::sleeping_panel::StaleStep : uint8_t

What a screen does this tick with a value that is wrong once stale.

Enumerator
Live 

The panel is lit: paint the value as usual, on its own clock.

Hide 

Paint the screen now with the value hidden, once.

Hold 

Paint nothing: the value is hidden, or the glass keeps it.

Restore 

The panel is lit again after a hide: paint the value in full.

ThemeMode #

enum class kleidos::ui::ThemeMode : uint8_t

User-selectable UI theme polarity.

Enumerator
Light 

Paper-white background, dark content (e-paper default).

Dark 

Dark background, light content (color-TFT default).

Back to the top

Function Documentation

applyEasing() #

float kleidos::ui::applyEasing(Easing easing, float t)
constexpr

Evaluate a named easing curve at normalized progress t.

Parameters
NameDirectionMeaning
easinginCurve to apply.
tinNormalized progress in [0,1] (clamped per-curve).
Returns
Eased progress.

base64() #

std::size_t kleidos::ui::key_text::base64(const uint8_t * bytes, std::size_t len, char * out, std::size_t cap)
inline

Write len bytes as standard base64 (RFC 4648, with padding).

Parameters
NameDirectionMeaning
bytesinThe key bytes.
leninHow many bytes to encode.
outoutText buffer, always NUL-terminated when cap > 0.
capinSize of out in bytes; needs 4 * ceil(len / 3) + 1.
Returns
Characters written (excluding the NUL), or 0 when out is too small.

breakSecret() #

SecretBreak kleidos::ui::breakSecret(const char * value, std::size_t length, std::size_t perRow, std::span< SecretRow > rows)

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
NameDirectionMeaning
valueinThe secret (UTF-8; need not be NUL-terminated).
lengthinBytes of value to break.
perRowinCharacters a row holds (0 is taken as 1).
rowsoutCaller-owned rows; its size is the row budget.
Returns
The rows filled, and whether they hold the whole value.

buildMaskRowUtf8() #

std::size_t kleidos::ui::buildMaskRowUtf8(char * dst, std::size_t dstCap, std::size_t count)
inline

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
NameDirectionMeaning
dstoutDestination byte buffer (must be non-null when dstCap>0).
dstCapinCapacity of dst in bytes (including the NUL terminator).
countinNumber of mask glyphs requested.
Returns
Number of bytes written before the terminator (always < dstCap).

buildOklabLut() #

void kleidos::ui::gradient::buildOklabLut(const uint16_t * stops, std::size_t stopCount, uint16_t * out, std::size_t count)

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
NameDirectionMeaning
stopsinRGB565 stop colors (first → last across the gradient).
stopCountinNumber of stops in stops.
outoutDestination LUT (filled with count entries).
countinNumber of LUT entries to write (out capacity).

cell() #

Rect kleidos::ui::flex::cell(const Rect & track, Axis axis, int16_t count, int16_t gap, int16_t index)
constexpr

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
NameDirectionMeaning
trackinThe rect to distribute within.
axisinDistribution axis.
countinNumber of cells (>= 1).
gapinGap in pixels between adjacent cells.
indexinCell index in [0, count).
Returns
The rect for cell index, or an empty rect if inputs are invalid.

defaultThemeMode() #

ThemeMode kleidos::ui::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() #

float kleidos::ui::easeInOutQuad(float t)
constexpr

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
NameDirectionMeaning
tinNormalized progress in [0,1] (values outside are clamped).
Returns
Eased progress in [0,1].

easeOutBack() #

float kleidos::ui::easeOutBack(float t)
constexpr

Ease-out "back" at normalized progress t (clamped to [0,1]).

Decelerates past the target then settles onto it — a subtle spring/overshoot for selection snap ("alive" feel). f(t) = 1 + (c+1)(t-1)^3 + c(t-1)^2 with c = kBackOvershoot. Pure and constexpr; endpoints are exactly 0 and 1 (the peak between is slightly > 1, which is the intended overshoot).

Parameters
NameDirectionMeaning
tinNormalized progress in [0,1] (values outside are clamped).
Returns
Eased progress, ≥0, reaching exactly 1 at t = 1 (peaks above 1).

easeOutQuad() #

float kleidos::ui::easeOutQuad(float t)
constexpr

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
NameDirectionMeaning
tinNormalized progress in [0,1] (values outside are clamped).
Returns
Eased progress in [0,1].

editorSaveRect() #

Rect kleidos::ui::editorSaveRect(const Rect & actions)
constexpr

The Save button that ends an editor's action row.

Parameters
NameDirectionMeaning
actionsinThe action row (TouchEditorRows::actions).
Returns
Save's rect, at the right end of actions.

fontTargetFor() #

const FontScale & kleidos::ui::tokens::fontTargetFor(Density d)
constexpr

Select the physical font targets (0.1 mm) for a density preset.

Parameters
NameDirectionMeaning
dinDensity preset (element-size band).
Returns
The physical font targets (0.1 mm) for that density preset.

groupedSecretLength() #

std::size_t kleidos::ui::groupedSecretLength(std::size_t length)
constexpr

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
NameDirectionMeaning
lengthinSecret length in characters.
Returns
The grouped length, excluding the terminator.

groupSecret() #

std::size_t kleidos::ui::groupSecret(char * out, std::size_t cap, const char * value)

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
NameDirectionMeaning
outoutDestination buffer (overwritten; NUL-terminated on return).
capinCapacity of out in bytes, terminator included.
valueinNUL-terminated secret (nullptr yields an empty result).
Returns
Characters written, excluding the terminator.

headerDepthColor565() #

uint16_t kleidos::ui::gradient::headerDepthColor565(float fraction)

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
NameDirectionMeaning
fractioninVertical 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() #

std::size_t kleidos::ui::key_text::hexGroups(const uint8_t * bytes, std::size_t len, std::size_t groupBytes, char * out, std::size_t cap)
inline

Write len bytes as lowercase hex in space-separated groups of groupBytes bytes ("a1b2 c3d4 …").

Parameters
NameDirectionMeaning
bytesinThe key bytes.
leninHow many bytes to write.
groupBytesinBytes per group (2 gives four hex digits); 0 = one group.
outoutText buffer, always NUL-terminated when cap > 0.
capinSize of out in bytes.
Returns
Characters written (excluding the NUL); what did not fit is left out.

isTinyScreen() [1/2] #

bool kleidos::ui::isTinyScreen()
inline

Runtime helper that queries the active display HAL.

On-device only; prefer the pure isTinyScreen(int16_t,int16_t) form in native tests.

Return values
ValueMeaning
trueActive display's smaller dimension is below kTinyScreenDimPx.
falseActive 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] #

bool kleidos::ui::isTinyScreen(int16_t width, int16_t height)
constexpr

True when the smaller display dimension is below the tiny breakpoint.

Pure function form for unit tests on the host (no display:: needed).

Parameters
NameDirectionMeaning
widthinDisplay width in pixels.
heightinDisplay height in pixels.
Return values
ValueMeaning
truemin(width, height) is below kTinyScreenDimPx.
falsemin(width, height) is at or above the breakpoint.

layoutEditorCells() #

int16_t kleidos::ui::layoutEditorCells(const Rect & row, std::span< const int16_t > widths, std::span< Rect > out)
constexpr

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
NameDirectionMeaning
rowinThe row to fill.
widthsinWidth of each cell.
outoutOne rect per width (extra entries are left alone).
Returns
The gap between two cells (0 with fewer than two cells).

markBodyBounds() #

Rect kleidos::ui::markBodyBounds(const MarkBodyShape & shape)
constexpr

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
NameDirectionMeaning
shapeinThe mark.
Returns
The box on the screen (not cut to it).

mmX10ToPxCeil() #

int16_t kleidos::ui::tokens::mmX10ToPxCeil(int16_t mmX10, int16_t ppi)
constexpr

Converts a physical length to panel pixels, rounding up.

Rounding up keeps a floor from shrinking below its physical size.

Parameters
NameMeaning
mmX10Length in 0.1 mm units.
ppiPanel density in pixels per inch.
Returns
The length in pixels, rounded up.

oklabLerpRgb565() #

uint16_t kleidos::ui::gradient::oklabLerpRgb565(uint16_t from, uint16_t to, float t)

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
NameDirectionMeaning
frominRGB565 color at t = 0.
toinRGB565 color at t = 1.
tinBlend position in [0,1] (values outside are clamped).
Returns
OKLab-interpolated RGB565 color.

paints() #

bool kleidos::ui::sleeping_panel::paints(bool panelAsleep)
nodiscardconstexpr

Whether a repaint that answers no input may paint now.

Parameters
NameDirectionMeaning
panelAsleepinWhether the panel sleeps (display::isAsleep).
Return values
ValueMeaning
trueThe panel is awake.
falseThe panel sleeps: paint nothing, and keep the repaint pending.

place() #

bool kleidos::ui::column_flow::place(std::span< const Row > rows, int16_t top, int16_t bottom, std::span< int16_t > tops)
constexpr

Place rows top to bottom in the band from top to bottom.

Parameters
NameDirectionMeaning
rowsinThe rows, top to bottom, their design offsets ascending.
topinFirst pixel row of the band.
bottominPixel row the band ends before (exclusive).
topsoutReceives each row's top; must hold at least rows.size().
Return values
ValueMeaning
trueEvery row lies inside the band.
falseThe rows alone are taller than the band: they are stacked from top with no gap and run past bottom. Also false, with nothing written, when tops is shorter than rows.

raiseFontToFloor() #

FontScale kleidos::ui::tokens::raiseFontToFloor(const FontScale & f, const FontScale & floor)
constexpr

Raise each font role to at least the matching floor.

Parameters
NameDirectionMeaning
finResolved per-role pixel sizes.
floorinPer-role minimum sizes.
Returns
f with every role clamped up to floor (element-wise max).

readableDetail() #

TextRole kleidos::ui::readableDetail(const LayoutContext & layout)
constexpr

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
NameDirectionMeaning
layoutinResponsive context.
Returns
BODY on a monochrome or roomy panel, SMALL elsewhere.

refViewDistanceFor() #

int16_t kleidos::ui::tokens::refViewDistanceFor(Density d)
constexpr

Reference viewing distance of density band d (0.1 mm units).

Parameters
NameDirectionMeaning
dinDensity preset.
Returns
The distance the band's physical-mm targets were tuned at.

resolveMetrics() #

Metrics kleidos::ui::tokens::resolveMetrics(Density d, int16_t ppi, int16_t minorDimPx)
constexpr

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
NameDirectionMeaning
dinDensity preset (element-size band).
ppiinPanel pixels-per-inch.
minorDimPxinShorter (effective) panel dimension in pixels.
Returns
Resolved, clamped pixel metrics.

resolvePx() #

int16_t kleidos::ui::tokens::resolvePx(int16_t targetMmX10, int16_t ppi, int16_t minorDimPx, const BudgetCap & cap)
constexpr

Resolve a physical target (0.1 mm) to a clamped pixel size.

px = round(target_0p1mm × ppi / 254), then capped at minorDimPx × cap. Always returns at least 1 px so a present element never vanishes.

Parameters
NameDirectionMeaning
targetMmX10inPhysical target in 0.1 mm units.
ppiinPanel pixels-per-inch.
minorDimPxinShorter panel dimension in pixels (the budget anchor).
capinBudget cap (fraction of minorDimPx) for this role.
Returns
The PPI-resolved, budget-clamped pixel size (>= 1).

roundUpToGrid() #

int16_t kleidos::ui::tokens::roundUpToGrid(int16_t px, int16_t grid)
constexpr

Rounds a pixel length up to the next multiple of a grid step.

Parameters
NameMeaning
pxLength in pixels.
gridGrid step in pixels; 0 or less leaves px unchanged.
Returns
px rounded up to a multiple of grid.

secretLines() #

SecretLayout kleidos::ui::secretLines(std::size_t length, int16_t widthPx, int16_t advancePx)

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
NameDirectionMeaning
lengthinSecret length in characters.
widthPxinRow width available, in pixels.
advancePxinAdvance of one character in the monospace face.
Returns
The row count and whether the grouped form fits in it.

segmentPillX() #

int16_t kleidos::ui::segmentPillX(const TabIndicatorGeometry & g, uint8_t index)
constexpr

Left-edge X of the active pill for segment index index.

The pill is centered within its segment: trackX + index*segW + (segW-pillW)/2. This is the value the ui::Tween animates between when the page changes.

Parameters
NameDirectionMeaning
ginResolved geometry from tabIndicatorGeometry.
indexinActive segment index (0-based; not bounds-checked here — the caller passes a valid page index).
Returns
Pill left-edge X in pixels.

selectionBandColor565() #

uint16_t kleidos::ui::gradient::selectionBandColor565(float fraction)

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
NameDirectionMeaning
fractioninVertical 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() #

bool kleidos::ui::setThemeMode(ThemeMode mode)
nodiscard

Set, persist (NVS), and apply the theme mode. The caller should request a full screen redraw afterwards so the new polarity is rendered.

Parameters
NameDirectionMeaning
modeinThe new theme mode.
Return values
ValueMeaning
trueThe mode is applied and stored.
falseThe 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() #

const SpaceScale & kleidos::ui::tokens::spaceTargetFor(Density d)
constexpr

Select the physical spacing targets (0.1 mm) for a density preset.

Parameters
NameDirectionMeaning
dinDensity preset (element-size band).
Returns
The physical spacing targets (0.1 mm) for that density preset.

split() #

Rect kleidos::ui::flex::split(const Rect & track, Axis axis, int16_t size, bool fromStart, Rect & band)
constexpr

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
NameDirectionMeaning
trackinThe rect to split.
axisinSplit axis (Horizontal carves a left band).
sizeinBand thickness in pixels.
fromStartinTrue to carve from the start edge (top/left), else end.
bandoutReceives the carved band rect.
Returns
The remaining rect after the band (and no gap) is removed.

tabIconStripGeometry() #

TabIndicatorGeometry kleidos::ui::tabIconStripGeometry(int16_t width, uint8_t segments)
constexpr

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
NameDirectionMeaning
widthinPanel/content width in pixels.
segmentsinNumber of tab cells (>= 1).
Returns
Resolved geometry; zero-sized when segments is zero or width is not positive.

tabIndicatorGeometry() #

TabIndicatorGeometry kleidos::ui::tabIndicatorGeometry(int16_t width, int16_t insetX, int16_t pillInsetX, uint8_t segments)
constexpr

Compute the segmented indicator geometry for a given content width.

Parameters
NameDirectionMeaning
widthinPanel/content width in pixels.
insetXinHorizontal inset applied on each side (e.g. the medium spacing step).
pillInsetXinInset subtracted from a segment to form the pill width (e.g. space.xs), so adjacent pills read as separate.
segmentsinNumber of page segments (>= 1).
Returns
Resolved geometry; zero-sized when width is too small or segments is zero.

themeIsLight() #

bool kleidos::ui::themeIsLight()
Returns
True when the active mode is ui::ThemeMode::Light.

themeMode() #

ThemeMode kleidos::ui::themeMode()

The active theme mode (the persisted value, or the default before init).

Returns
The currently applied ui::ThemeMode.

toRgb565() #

uint16_t kleidos::ui::theme::toRgb565(uint32_t c)
constexpr

Compile-time conversion from a 24-bit RGB color to 16-bit RGB565.

Parameters
NameDirectionMeaning
cin24-bit color in 0xRRGGBB format.
Returns
16-bit RGB565 representation.

touchEditorRows() #

TouchEditorRows kleidos::ui::touchEditorRows(const LayoutContext & layout, int16_t headerH)
constexpr

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
NameDirectionMeaning
layoutinResponsive context.
headerHinHeight of the header the rows sit under.
Returns
The three rows.

Back to the top

Variable Documentation

kCapLarge #

BudgetCap kleidos::ui::tokens::kCapLarge
constexpr

large <= minorDim * 3/8 (headline).

kCapSpace #

BudgetCap kleidos::ui::tokens::kCapSpace
constexpr

Spacing values are capped to keep at least a usable content band on tiny panels.

any single gap <= minorDim / 4.

kCoreTouchCozyRow #

int16_t kleidos::ui::tokens::kCoreTouchCozyRow
constexpr

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 #

int16_t kleidos::ui::kEditorSaveW
inlineconstexpr

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 #

uint32_t kleidos::ui::kEntryRevealAutoHideMs
inlineconstexpr

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 #

int16_t kleidos::ui::tokens::kEpaperActionBarPx
constexpr

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 #

Bands kleidos::ui::tokens::kEpaperBands
constexpr

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 #

std::size_t kleidos::ui::kSecretGroupSize
constexpr

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 #

std::size_t kleidos::ui::kSecretMaxRows
inlineconstexpr

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 #

std::size_t kleidos::ui::gradient::kSelectionBandEntries
inlineconstexpr

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 #

uint32_t kleidos::ui::tokens::motion::kSpinMs
inlineconstexpr

motion.spin: one turn of the verify wait's segment, the one ring that turns (ms). The indeterminate progress card (popup::spinnerShow) moves a segment along its bar instead.

kSubtle #

uint16_t kleidos::ui::tokens::color::kSubtle
constexpr

Row dividers, borders.

kTabTrackGap #

int16_t kleidos::ui::kTabTrackGap
inlineconstexpr

Vertical gap between the indicator track and the first list row, so the pager does not kiss the header baseline or the list.

kTabTrackH #

int16_t kleidos::ui::kTabTrackH
inlineconstexpr

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.

Back to the top