Readouts

label_value and label_valuef pair a fixed label with a value. badge is a small pill of coloured text. It is as wide as its label, and in a narrow row the label wraps and the pill grows taller rather than spilling. The label has no length limit. dot is a status light that can pulse. progress and meter draw one fraction, continuous or as discrete cells. sparkline and bars draw a history of values as a trace or as a bar chart. The value in a label row is set in the mono face, so a changing number never shifts the column.

Readouts, label value, meter, sparkline, bars and dot, drawn by isolenReadouts, label value, meter, sparkline, bars and dot, drawn by isolen
widgets_display.cpp
#include "isolenui/ui/ui.h"
#include "isolenui/kit/kit.h"

// red is the low byte and alpha the high byte, see the styles page
constexpr uint32_t abgr(uint32_t r, uint32_t g, uint32_t b, uint32_t a = 255u)
{
    return r | (g << 8) | (b << 16) | (a << 24);
}

static void status_readout(ui::ctx* u, float cpu_load, const float* history,
                            uint32_t history_count)
{
    // label_value, a fixed label beside a fixed string
    ui::label_value(u, "backend", "vulkan");

    // label_valuef, the same thing with a printf style value
    ui::label_valuef(u, "cpu", "%.1f%%", cpu_load);

    // badge, a small pill of colored text
    ui::badge(u, "beta", abgr(0x8a, 0x64, 0xe5));

    // dot, a status light, pulsing when something is live
    ui::dot(u, abgr(0x64, 0xc8, 0x6e), true);

    // progress, a single fraction between zero and one
    ui::progress(u, cpu_load / 100.0f);

    // meter, the same fraction drawn as discrete cells
    ui::meter(u, cpu_load / 100.0f, 10u);

    // sparkline, a thin trace over recent history
    ui::sparkline(u, history, history_count, abgr(0x6d, 0x98, 0xcc));

    // bars, the same history drawn as a bar chart
    ui::bars(u, history, history_count, abgr(0x6d, 0x98, 0xcc));
}

Last updated 6 October 2026