isocline
Terminal

Experimental: Low level terminal output. More...

Functions

void ic_term_init (void)
 Initialize for terminal output. More...
 
void ic_term_done (void)
 Call this when done with the terminal functions. More...
 
void ic_term_flush (void)
 Flush the terminal output. More...
 
void ic_term_write (const char *s)
 Write a string to the console (and process CSI escape sequences). More...
 
void ic_term_writeln (const char *s)
 Write a string to the console and end with a newline (and process CSI escape sequences). More...
 
void ic_term_writef (const char *fmt,...)
 Write a formatted string to the console. More...
 
void ic_term_vwritef (const char *fmt, va_list args)
 Write a formatted string to the console. More...
 
void ic_term_style (const char *style)
 Set text attributes from a style. More...
 
void ic_term_bold (bool enable)
 Set text attribute to bold. More...
 
void ic_term_underline (bool enable)
 Set text attribute to underline. More...
 
void ic_term_italic (bool enable)
 Set text attribute to italic. More...
 
void ic_term_reverse (bool enable)
 Set text attribute to reverse video. More...
 
void ic_term_color_ansi (bool foreground, int color)
 Set text attribute to ansi color palette index between 0 and 255 (or 256 for the ANSI "default" color). More...
 
void ic_term_color_rgb (bool foreground, uint32_t color)
 Set text attribute to 24-bit RGB color (between 0x000000 and 0xFFFFFF). More...
 
void ic_term_reset (void)
 Reset the text attributes. More...
 
int ic_term_get_color_bits (void)
 Get the palette used by the terminal: This is usually initialized from the COLORTERM environment variable. More...
 

Detailed Description

Experimental: Low level terminal output.

Ensures basic ANSI SGR escape sequences are processed in a portable way (e.g. on Windows)

Function Documentation

◆ ic_term_bold()

void ic_term_bold ( bool  enable)

Set text attribute to bold.

◆ ic_term_color_ansi()

void ic_term_color_ansi ( bool  foreground,
int  color 
)

Set text attribute to ansi color palette index between 0 and 255 (or 256 for the ANSI "default" color).

(auto matched to smaller palette if not supported)

◆ ic_term_color_rgb()

void ic_term_color_rgb ( bool  foreground,
uint32_t  color 
)

Set text attribute to 24-bit RGB color (between 0x000000 and 0xFFFFFF).

(auto matched to smaller palette if not supported)

◆ ic_term_done()

void ic_term_done ( void  )

Call this when done with the terminal functions.

◆ ic_term_flush()

void ic_term_flush ( void  )

Flush the terminal output.

(happens automatically on newline characters ('
') as well).

◆ ic_term_get_color_bits()

int ic_term_get_color_bits ( void  )

Get the palette used by the terminal: This is usually initialized from the COLORTERM environment variable.

The possible values of COLORTERM for each palette are given in parenthesis.

  • 1: monochrome (monochrome)
  • 3: old ANSI terminal with 8 colors, using bold for bright (8color/3bit)
  • 4: regular ANSI terminal with 16 colors. (16color/4bit)
  • 8: terminal with ANSI 256 color palette. (256color/8bit)
  • 24: true-color terminal with full RGB colors. (truecolor/24bit/direct)

◆ ic_term_init()

void ic_term_init ( void  )

Initialize for terminal output.

Call this before using the terminal write functions (ic_term_write) Does nothing on most platforms but on Windows it sets the console to UTF8 output and possible enables virtual terminal processing.

◆ ic_term_italic()

void ic_term_italic ( bool  enable)

Set text attribute to italic.

◆ ic_term_reset()

void ic_term_reset ( void  )

Reset the text attributes.

◆ ic_term_reverse()

void ic_term_reverse ( bool  enable)

Set text attribute to reverse video.

◆ ic_term_style()

void ic_term_style ( const char *  style)

Set text attributes from a style.

◆ ic_term_underline()

void ic_term_underline ( bool  enable)

Set text attribute to underline.

◆ ic_term_vwritef()

void ic_term_vwritef ( const char *  fmt,
va_list  args 
)

Write a formatted string to the console.

◆ ic_term_write()

void ic_term_write ( const char *  s)

Write a string to the console (and process CSI escape sequences).

◆ ic_term_writef()

void ic_term_writef ( const char *  fmt,
  ... 
)

Write a formatted string to the console.

(and process CSI escape sequences)

◆ ic_term_writeln()

void ic_term_writeln ( const char *  s)

Write a string to the console and end with a newline (and process CSI escape sequences).