Skip to content

Modern Tui TuiLerpColor

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

Home › Terminal TUI Library › Charts › TuiLerpColor

TuiLerpColor

Returns a colour part of the way between two others, for t from 0 to 1.

Syntax

TuiLerpColor( byval a as TuiColor, byval b as TuiColor, byval t as float64 ) as TuiColor

Description

Linear interpolation between two colours, t from 0 to 1. What a meter's gradient is made of, exposed because it is useful for a heat map or a threshold colour of your own.

Example

#import "std/tui"
using tui

dim as TuiColor green_ = TuiRgb( 0, 255, 0 )
dim as TuiColor red_ = TuiRgb( 255, 0, 0 )
print TuiLerpColor( green_, red_, 0.0 ).g      '' 255
print TuiLerpColor( green_, red_, 1.0 ).r      '' 255
print TuiLerpColor( green_, red_, 0.5 ).r '' 128

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