NetSurf
Macros | Functions | Variables
system_colour.c File Reference

System colour handling implementation. More...

#include <string.h>
#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/css.h"
#include "desktop/system_colour.h"
Include dependency graph for system_colour.c:

Go to the source code of this file.

Macros

#define colour_list_len   ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)
 

Functions

nserror ns_system_colour_init (void)
 Initialise the system colours. More...
 
void ns_system_colour_finalize (void)
 release any resources associated with the system colours. More...
 
nserror ns_system_colour_char (const char *name, colour *colour_out)
 Obtain a system colour from a name. More...
 
css_error ns_system_colour (void *pw, lwc_string *name, css_color *colour)
 css callback to obtain named system colour. More...
 

Variables

static lwc_string * colour_list [colour_list_len]
 
static lwc_string ** ns_system_colour_pw = NULL
 

Detailed Description

System colour handling implementation.

Definition in file system_colour.c.

Macro Definition Documentation

◆ colour_list_len

#define colour_list_len   ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)

Definition at line 34 of file system_colour.c.

Function Documentation

◆ ns_system_colour()

css_error ns_system_colour ( void *  pw,
lwc_string *  name,
css_color *  color 
)

css callback to obtain named system colour.

Parameters
[in]pwcontext unused in implementation
[in]nameThe name of the colour being looked up
[out]colorThe system colour associated with the name.
Returns
CSS_OK and color updated on success else CSS_INVALID if the name is unrecognised

Definition at line 95 of file system_colour.c.

References colour_list, colour_list_len, ns_color_to_nscss, NSOPTION_SYS_COLOUR_START, nsoptions, and nsoption_s::value.

Referenced by nscss_create_css_data(), nscss_create_inline_style(), and nscss_register_import().

Here is the caller graph for this function:

◆ ns_system_colour_char()

nserror ns_system_colour_char ( const char *  name,
colour color 
)

Obtain a system colour from a name.

Parameters
[in]nameThe name of the colour being looked up
[out]colorThe system colour associated with the name in the netsurf colour representation.
Returns
NSERROR_OK and color updated on success else appropriate error code.

Definition at line 78 of file system_colour.c.

References nsoption_s::c, colour_list_len, nsoption_s::key, NSERROR_INVALID, NSERROR_OK, NSOPTION_SYS_COLOUR_START, nsoptions, SLEN, and nsoption_s::value.

Referenced by nscolour__get(), and nscolour_update().

Here is the caller graph for this function:

◆ ns_system_colour_finalize()

void ns_system_colour_finalize ( void  )

release any resources associated with the system colours.

Definition at line 67 of file system_colour.c.

References colour_list, and colour_list_len.

Referenced by netsurf_exit().

Here is the caller graph for this function:

◆ ns_system_colour_init()

nserror ns_system_colour_init ( void  )

Initialise the system colours.

Returns
NSERROR_OK on success else appropriate error code.

Definition at line 42 of file system_colour.c.

References colour_list, colour_list_len, nsoption_s::key, nsoption_s::key_len, ns_system_colour_pw, NSERROR_INIT_FAILED, NSERROR_NOMEM, NSERROR_OK, NSOPTION_SYS_COLOUR_START, nsoptions, and SLEN.

Referenced by netsurf_init().

Here is the caller graph for this function:

Variable Documentation

◆ colour_list

lwc_string* colour_list[colour_list_len]
static

◆ ns_system_colour_pw

lwc_string** ns_system_colour_pw = NULL
static

Definition at line 38 of file system_colour.c.

Referenced by ns_system_colour_init().