VT100/ANSI terminal control helpers and telnet negotiation support.
More...
#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <stdbool.h>
#include <ctype.h>
#include <math.h>
#include <stddef.h>
|
|
#define | COLOR_PALETTE_CACHE_MAX 256 |
| |
|
#define | SGR_CODES_MAX 32 |
| |
VT100/ANSI terminal control helpers and telnet negotiation support.
- Author
- TinyMUSH development team (https://github.com/TinyMUSH)
- Version
- 4.0
- Copyright
- Copyright (C) 1989-2025 TinyMUSH development team. You may distribute under the terms the Artistic License, as specified in the COPYING file.
◆ Ansi2VT100()
| char * Ansi2VT100 |
( |
uint8_t | color, |
|
|
bool | background ) |
Format ANSI color to VT100 color sequence.
- Parameters
-
| color | ANSI color code |
| background | True if background color |
- Returns
- char* VT100 color sequence
◆ getColorMatch()
Find the closest color in a palette.
- Parameters
-
- Returns
- COLORMATCH
◆ RGB2Ansi()
Convert RGB values to ANSI color code.
- Parameters
-
- Returns
- uint8_t ANSI color code
◆ RGB2X11()
Convert RGB values to X11 color code.
- Parameters
-
- Returns
- uint8_t X11 color code
◆ rgbToXyz()
Convert RGB color to XYZ coordonates.
The CIE 1931 color spaces are the first defined quantitative links between distributions of wavelengths in the electromagnetic visible spectrum, and physiologically perceived colors in human color vision. The mathematical relationships that define these color spaces are essential tools for color management, important when dealing with color inks, illuminated displays, and recording devices such as digital cameras. The system was designed in 1931 by the "Commission Internationale de l'éclairage", known in English as the International Commission on Illumination.
- Parameters
-
- Returns
- xyzColor XYZ Coordinates
◆ TrueColor2VT100()
| char * TrueColor2VT100 |
( |
rgbColor | rgb, |
|
|
bool | background ) |
Format RGB color to VT100 color sequence.
- Parameters
-
| rgb | RGB Color to format |
| background | True if background color |
- Returns
- char* VT100 color sequence
◆ X112Ansi()
| uint8_t X112Ansi |
( |
int | color | ) |
|
Convert X11 color code to RGB value.
- Parameters
-
- Returns
- rgbColor RGB Color
◆ X112RGB()
Convert X11 color code to RGB value.
- Parameters
-
- Returns
- rgbColor RGB Color
◆ X112VT100()
| char * X112VT100 |
( |
uint8_t | color, |
|
|
bool | background ) |
Format X11 color to VT100 color sequence.
- Parameters
-
| color | X11 color code |
| background | True if background color |
- Returns
- char* VT100 color sequence
◆ xyzToCIELAB()
Convert XYZ coordinates to CIELAB Color Space coordinates.
The CIELAB color space also referred to as L*a*b* is a color space defined by the International Commission on Illumination (abbreviated CIE) in 1976. (Referring to CIELAB as "Lab" without asterisks should be avoided to prevent confusion with Hunter Lab.) It expresses color as three values: L* for perceptual lightness, and a* and b* for the four unique colors of human vision: red, green, blue, and yellow. CIELAB was intended as a perceptually uniform space, where a given numerical change corresponds to similar perceived change in color. While the LAB space is not truly perceptually uniform, it nevertheless is useful in industry for detecting small differences in color.
- Parameters
-
- Returns
- CIELABColorSpace