Skip to content

Modern Tui TuiDowngrade

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

Home › Terminal TUI Library › Colour and Style › TuiDowngrade

TuiDowngrade

Returns the colour that a terminal with fewer colours would show instead.

Syntax

TuiDowngrade( byval c as TuiColor, byval depth as TuiColorDepth ) as TuiColor

Description

Reduces one colour to what a terminal of the given depth can show. You rarely call this -- the renderer does it for every cell -- but it is here so you can predict what a colour will become.

Example

#import "std/tui"
using tui

dim as TuiColor c = TuiRgb( 235, 80, 80 )
print TuiDowngrade( c, TUIDEPTH_TRUECOLOR ).r     '' 235 -- untouched
print TuiDowngrade( c, TUIDEPTH_256 ).kind = TUICOLOR_INDEXED '' -1 (true)
print TuiDowngrade( c, TUIDEPTH_ANSI16 ).Index( ) '' 8

See also

TuiColor TuiColor.Equals TuiDefaultColor TuiIndexed TuiBlack TuiGreen
TuiColor.IsDefault TuiColor.Index TuiAnsi TuiRgb TuiRed TuiYellow

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Colour and Style
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally