Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
colors.h File Reference
#include "config.h"
#include <stdint.h>
Include dependency graph for colors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int32_t a_Color_parse (const char *str, int32_t default_color, int *err)
 Parse a color string.
 
int32_t a_Color_vc (int32_t candidate, int32_t c1, int32_t c2, int32_t c3)
 Return a suitable "visited link" color.
 

Function Documentation

◆ a_Color_parse()

int32_t a_Color_parse ( const char *  str,
int32_t  default_color,
int *  err 
)

Parse a color string.

  • If the string begins with # or with 0x, return the color number (with 'RGB' expanded to 'RRGGBB').
  • Else search the set of named colors.
  • As a last resort, treat it as bare hex as in the first case.
Returns
  • Parsed color if successful,
  • default_color on error.

"err" argument:

  • 0 if a color beginning with '#' is successfully parsed or the color is a recognized word.
  • 1 if the color is bare hex or can't be parsed at all.
  • 2 if a color beginning with 0[xX] is successfully parsed.

Definition at line 258 of file colors.c.

References _MSG, color_keyword, Color_parse_hex(), dIsspace, dStrAsciiCasecmp(), and NCOLORS.

Referenced by a_Html_color_parse(), parseOption(), CssParser::parseValue(), and CssParser::tokenMatchesProperty().

◆ a_Color_vc()

int32_t a_Color_vc ( int32_t  candidate,
int32_t  C_txt,
int32_t  C_lnk,
int32_t  C_bg 
)

Return a suitable "visited link" color.

Returns
  • if candidate has good contrast with C_txt, C_lnk and C_bg -> candidate
  • else another color (from the internal list)

Definition at line 344 of file colors.c.

References _MSG, Color_distance2(), and Color_distance3().

Referenced by Html_tag_open_body().