Skip to content

Modern Tui TuiMeter

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Terminal TUI Library › Charts › TuiMeter

TuiMeter

Draws a bar filled to a ratio whose colour shades from one end to the other.

Syntax

type TuiMeter extends TuiWidget
    as float64 ratio
    as TuiColor from_, to_
    as TuiColor trackColor
    as boolean partialCells
    as uint8 meterStyle
    as int32 segmentEvery
end type

Description

A gradient bar: the colour interpolates from from_ to to_ ALONG THE BAR, so a meter reads green at the left and red at the right regardless of how full it is. partialCells uses eighth-blocks for sub-cell precision. from_ and to_ carry underscores because FROM and TO are keywords.

Example

#import "std/tui"
using tui

dim as TuiScreen scr
scr.Resize( 30, 1 )
dim as TuiFrame ptr f = scr.BeginFrame( )

dim as TuiMeter m
m.ratio = 0.62
m.from_ = TuiRgb( 80, 220, 120 )
m.to_ = TuiRgb( 235, 80, 80 )
m.trackColor = TuiRgb( 60, 60, 60 )
m.partialCells = TRUE
m.meterStyle = TUIMETER_SEGMENTED       '' SOLID HATCHED SEGMENTED
m.segmentEvery = 3
m.Render( *f, f->Area( ) )

See also

TuiCanvas TuiCanvas.Dot TuiCanvas.DotWidth TuiCanvas.CellRows
TuiCanvas.Resize TuiCanvas.Line_ TuiCanvas.DotHeight TuiCanvas.Pattern
TuiCanvas.Clear TuiCanvas.Blit TuiCanvas.CellCols TuiSeries

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Charts
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally