KazDragon / terminalpp

A C++ library for interacting with ANSI terminal windows.
MIT License
75 stars 10 forks source link

Addition of TrueColor support #284

Closed KazDragon closed 2 years ago

KazDragon commented 2 years ago

On top of ANSI 256 colour mode, some terminals support TrueColor, which has 24-bit colour depth.

This is specified similarly to 256-bit (high) colour with different arguments. Where setting the foreground colour in 256-bit colour is "\e[38;5;<val>m", setting the foreground colour in TrueColor is "\e[38;2;<r>;<g>;<b>m", where r, g and b are values from 0-255.

This comes with a trade-off, as it would expand the size of colour from 2 to 4 bytes.

KazDragon commented 2 years ago

https://gist.github.com/XVilka/8346728