That Terminal
A terminal emulator designed for video making purposes.
256color.cc File Reference

Defines xterm256table. More...

#include "256color.hh"
#include "color.hh"
Include dependency graph for 256color.cc:

Functions

constexpr unsigned Make16 (unsigned r, unsigned g, unsigned b)
 

Variables

constexpr unsigned char grayramp [24] = { 1,2,3,5,6,7,8,9,11,12,13,14,16,17,18,19,20,22,23,24,25,27,28,29 }
 
constexpr unsigned char colorramp [6] = { 0,12,16,21,26,31 }
 
const constinit std::array< unsigned, 256 > xterm256table
 

Detailed Description

Defines xterm256table.

Function Documentation

◆ Make16()

constexpr unsigned Make16 ( unsigned  r,
unsigned  g,
unsigned  b 
)
constexpr

Converts 5-bit colors into 8-bit colors.

Variable Documentation

◆ xterm256table

const constinit std::array<unsigned,256> xterm256table
Initial value:
= []() consteval
{
std::array<unsigned,256> result =
{
Make16(0,0,0), Make16(21,0,0), Make16(0,21,0), Make16(21,10,0),
Make16(0,0,21), Make16(21,0,21), Make16(0,21,21), Make16(21,21,21),
Make16(15,15,15), Make16(31,10,10), Make16(5,31,10), Make16(31,31,10),
Make16(10,10,31), Make16(31,10,31), Make16(5,31,31), Make16(31,31,31)
};
for(unsigned n=0; n<216; ++n)
{
result[16+n] = Make16(colorramp[(n/36)%6], colorramp[(n/6)%6], colorramp[(n)%6]);
}
for(unsigned n=0; n<24; ++n)
{
result[232 + n] = Make16(grayramp[n],grayramp[n],grayramp[n]);
}
return result;
}()
constexpr unsigned Make16(unsigned r, unsigned g, unsigned b)
Definition: 256color.cc:13

Builds and defines the table of 256 colors. 8-bit index, 24-bit value.