ELinks 0.18.0
color.c File Reference

Color parser. More...

#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "util/color.h"
#include "util/conv.h"
#include "util/fastfind.h"
#include "util/color_s.inc"
#include "util/color.inc"
Include dependency graph for color.c:

Data Structures

struct  color_spec
 

Functions

static void colors_list_reset (void)
 
static struct fastfind_key_valuecolors_list_next (void)
 Returns a pointer to a struct that contains current key and data pointers and increment internal pointer.
 
void init_colors_lookup (void)
 
void free_colors_lookup (void)
 
int decode_color (const char *str, int slen, color_T *color)
 Decode the color string.
 
const char * get_color_string (color_T color, char hexcolor[8])
 Returns a string containing the color info.
 
void color_to_string (color_T color, char str[8])
 Translate rgb color to string in #rrggbb format.
 

Variables

static const struct color_spec color_specs []
 
static const struct color_specinternal_pointer
 
static struct fastfind_index ff_colors_index = INIT_FASTFIND_INDEX("colors_lookup", colors_list_reset, colors_list_next)
 

Detailed Description

Color parser.

Function Documentation

◆ color_to_string()

void color_to_string ( color_T color,
char str[8] )

Translate rgb color to string in #rrggbb format.

str should be a pointer to an 8 bytes memory space.

◆ colors_list_next()

static struct fastfind_key_value * colors_list_next ( void )
static

Returns a pointer to a struct that contains current key and data pointers and increment internal pointer.

It returns NULL when key is NULL.

◆ colors_list_reset()

static void colors_list_reset ( void )
static

◆ decode_color()

int decode_color ( const char * str,
int slen,
color_T * color )

Decode the color string.

The color string can either contain '#FF0044' style declarations or color names.

◆ free_colors_lookup()

void free_colors_lookup ( void )

◆ get_color_string()

const char * get_color_string ( color_T color,
char hexcolor[8] )

Returns a string containing the color info.

If no 'English' name can be found the hex color (#rrggbb) is returned in the given buffer.

◆ init_colors_lookup()

void init_colors_lookup ( void )

Variable Documentation

◆ color_specs

const struct color_spec color_specs[]
static
Initial value:
= {
{ NULL, 0}
}
#define NULL
Definition explodename.c:35

◆ ff_colors_index

struct fastfind_index ff_colors_index = INIT_FASTFIND_INDEX("colors_lookup", colors_list_reset, colors_list_next)
static

◆ internal_pointer

const struct color_spec* internal_pointer
static