ANSI Select Graphic Rendition (SGR) command
In respect of colors, there are three alternative commands:
the 'ANSI' standards allow for eight standard colors (with two intensities). Windows and many other terminals (including xterm) allow the user to redefine the standard colors (so, for example Vivid Green may not correspond to bright green;
an extension of the standard that allows true colors (24 bit color depth) in RGB space. This is usually the best alternative for more colors; and
another extension that allows a palette of 256 colors, each color specified by an index. Xterm provides a protocol for a palette of 256 colors that many other terminals, including Windows 10, follow. Some terminals (including xterm) allow the user to redefine some or all of the palette colors.
Constructors
ResetDefault rendition, cancels the effect of any preceding occurrence of SGR (implementation-defined)
SetConsoleIntensity !ConsoleIntensitySet the character intensity. Partially supported natively on Windows 10
SetItalicized !BoolSet italicized. Not widely supported: sometimes treated as swapping foreground and background. Not supported natively on Windows 10
SetUnderlining !UnderliningSet or clear underlining. Partially supported natively on Windows 10
SetBlinkSpeed !BlinkSpeedSet or clear character blinking. Not supported natively on Windows 10
SetVisible !BoolSet revealed or concealed. Not widely supported. Not supported natively on Windows 10
SetSwapForegroundBackground !BoolSet negative or positive image. Supported natively on Windows 10
SetColor !ConsoleLayer !ColorIntensity !ColorSet a color from the standard palette of 16 colors (8 colors by 2 color intensities). Many terminals allow the palette colors to be customised
SetRGBColor !ConsoleLayer !(Colour Float)Set a true color (24 bit color depth). Supported natively on Windows 10 from the Creators Update (April 2017)
SetPaletteColor !ConsoleLayer !Word8Set a color from a palette of 256 colors using a numerical index (0-based). Supported natively on Windows 10 from the Creators Update (April 2017) but not on legacy Windows native terminals. See xtermSystem, xterm6LevelRGB and xterm24LevelGray to construct indices based on xterm's standard protocol for a 256-color palette.
SetDefaultColor !ConsoleLayerSet a color to the default (implementation-defined)