ELinks 0.16.1.1
color.h File Reference
#include "util/color.h"
Include dependency graph for color.h:
This graph shows which files directly or indirectly include this file:

Macros

#define TERM_COLOR_MASK   0x07
#define TERM_COLOR_FOREGROUND_16(color)
#define TERM_COLOR_BACKGROUND_16(color)

Typedefs

typedef unsigned char color_flags_T
typedef int color_mode_T

Enumerations

enum  color_flags {
  COLOR_DECREASE_LIGHTNESS = 1 , COLOR_ENHANCE_UNDERLINE = 2 , COLOR_INCREASE_CONTRAST = 4 , COLOR_ENSURE_CONTRAST = 8 ,
  COLOR_ENSURE_INVERTED_CONTRAST = 16
}
 Bit flags to control how the colors are handled. More...
enum  color_mode { COLOR_MODE_DUMP = -1 , COLOR_MODE_MONO = 0 , COLOR_MODE_16 = 1 , COLOR_MODES = 5 }
 How many colors the terminal supports. More...

Functions

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 mode)

Macro Definition Documentation

◆ TERM_COLOR_BACKGROUND_16

#define TERM_COLOR_BACKGROUND_16 ( color)
Value:
(((color)[0] >> 4) & TERM_COLOR_MASK)
#define TERM_COLOR_MASK
Definition color.h:20

◆ TERM_COLOR_FOREGROUND_16

#define TERM_COLOR_FOREGROUND_16 ( color)
Value:
((color)[0] & TERM_COLOR_MASK)

◆ TERM_COLOR_MASK

#define TERM_COLOR_MASK   0x07

Typedef Documentation

◆ color_flags_T

typedef unsigned char color_flags_T

◆ color_mode_T

typedef int color_mode_T

Enumeration Type Documentation

◆ color_flags

Bit flags to control how the colors are handled.

Enumerator
COLOR_DECREASE_LIGHTNESS 

Use a decreased color range.

COLOR_ENHANCE_UNDERLINE 

Mangle the color to stand out if attributes like underline are set.

Useful for terminals that don't support these attributes.

COLOR_INCREASE_CONTRAST 

Adjust the foreground color to be more readable by increasing the contrast.

COLOR_ENSURE_CONTRAST 

Adjust the contrast if the back- and foregroundcolor is equal.

If inverting should be done also pass the latter flag.

COLOR_ENSURE_INVERTED_CONTRAST 

◆ color_mode

enum color_mode

How many colors the terminal supports.

These numbers are used in the terminal._template_.colors and document.dump.color_mode options. They should be kept stable so that configuration files are portable between ELinks versions. Any unsupported modes should be treated as COLOR_MODE_16. (Can't fall back to COLOR_MODE_88 from COLOR_MODE_256 because the palettes are incompatible.)

Enumerator
COLOR_MODE_DUMP 
COLOR_MODE_MONO 
COLOR_MODE_16 
COLOR_MODES 

Function Documentation

◆ get_screen_char_color()

void get_screen_char_color ( struct screen_char * schar,
struct color_pair * pair,
color_flags_T flags,
color_mode_T color_mode )

◆ get_term_color16()

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.

◆ set_term_color()

void set_term_color ( struct screen_char * schar,
struct color_pair * pair,
color_flags_T flags,
color_mode_T mode )

◆ set_term_color16()

void set_term_color16 ( struct screen_char * schar,
color_flags_T flags,
unsigned char fg,
unsigned char bg )