|
ELinks 0.19.1
|
Terminal color composing. More...
#include "elinks.h"#include "terminal/color.h"#include "terminal/draw.h"#include "util/color.h"#include "util/error.h"#include "terminal/palette.inc"
Data Structures | |
| struct | rgb |
| struct | rgb_cache_entry |
| struct | color_mode_info |
Macros | |
| #define | RED_COLOR_MASK 0x00FF0000 |
| #define | GREEN_COLOR_MASK 0x0000FF00 |
| #define | BLUE_COLOR_MASK 0x000000FF |
| #define | RED_COLOR(color) |
| #define | GREEN_COLOR(color) |
| #define | BLUE_COLOR(color) |
| #define | RED(color) |
| #define | GREEN(color) |
| #define | BLUE(color) |
| #define | RGBCOLOR(color) |
| #define | RGB_HASH_SIZE 4096 |
| #define | HASH_RGB(color, l) |
| #define | CMPCODE(c) |
| #define | use_inverse(bg, fg) |
Typedefs | |
| typedef int | assert_enough_color_modes[(sizeof(color_modes)/sizeof(color_modes[0])==COLOR_MODES) ? 1 :-1] |
| Get a compile-time error if the color_modes array has the wrong size. | |
Enumerations | |
| enum | palette_range { PALETTE_FULL = 0 , PALETTE_HALF , PALETTE_RANGES } |
| Controls what color ranges to use when setting the terminal color. More... | |
Functions | |
| static int | color_distance (const struct rgb *c1, const struct rgb *c2) |
| static unsigned char | get_color (color_T color, const struct rgb *palette, int level) |
| Locates the nearest terminal color. | |
| NONSTATIC_INLINE void | set_term_color16 (struct screen_char *schar, color_flags_T flags, unsigned char fg, unsigned char bg) |
| color_T | get_term_color16 (unsigned int index) |
| Mixes the color pair and attributes to a terminal text color. | |
| void | get_screen_char_color (struct screen_char *schar, struct color_pair *pair, color_flags_T flags, color_mode_T color_mode) |
| void | set_term_color (struct screen_char *schar, struct color_pair *pair, color_flags_T flags, color_mode_T color_mode) |
Variables | |
| static const struct color_mode_info | color_mode_16 |
| static const struct color_mode_info *const | color_modes [] |
| static const char | fg_color [16][8] |
| Map foreground colors to more visible ones on various backgrounds. | |
Terminal color composing.
| #define BLUE | ( | color | ) |
| #define BLUE_COLOR | ( | color | ) |
| #define BLUE_COLOR_MASK 0x000000FF |
| #define CMPCODE | ( | c | ) |
| #define GREEN | ( | color | ) |
| #define GREEN_COLOR | ( | color | ) |
| #define GREEN_COLOR_MASK 0x0000FF00 |
| #define HASH_RGB | ( | color, | |
| l ) |
| #define RED | ( | color | ) |
| #define RED_COLOR | ( | color | ) |
| #define RED_COLOR_MASK 0x00FF0000 |
| #define RGB_HASH_SIZE 4096 |
| #define RGBCOLOR | ( | color | ) |
| #define use_inverse | ( | bg, | |
| fg ) |
| typedef int assert_enough_color_modes[(sizeof(color_modes)/sizeof(color_modes[0])==COLOR_MODES) ? 1 :-1] |
Get a compile-time error if the color_modes array has the wrong size.
| enum palette_range |
Controls what color ranges to use when setting the terminal color.
| Enumerator | |
|---|---|
| PALETTE_FULL | |
| PALETTE_HALF | |
| PALETTE_RANGES | |
Locates the nearest terminal color.
| void get_screen_char_color | ( | struct screen_char * | schar, |
| struct color_pair * | pair, | ||
| color_flags_T | flags, | ||
| color_mode_T | color_mode ) |
| color_T get_term_color16 | ( | unsigned int | index | ) |
Mixes the color pair and attributes to a terminal text color.
If flags has masked in the COLOR_INCREASE_CONTRAST the foreground color will be adjusted.
XXX: schar may not be NULL and is modified adding stuff like boldness.
| void set_term_color | ( | struct screen_char * | schar, |
| struct color_pair * | pair, | ||
| color_flags_T | flags, | ||
| color_mode_T | color_mode ) |
| NONSTATIC_INLINE void set_term_color16 | ( | struct screen_char * | schar, |
| color_flags_T | flags, | ||
| unsigned char | fg, | ||
| unsigned char | bg ) |
|
static |
|
static |
|
static |
Map foreground colors to more visible ones on various backgrounds.
Use like: fg = fg_color[fg][bg];
This table is based mostly on wild guesses of mine. Feel free to correct it. –pasky