NetSurf
Functions | Variables
nscolour.c File Reference

NetSurf UI colours (implementation). More...

#include <stdio.h>
#include <assert.h>
#include <stddef.h>
#include <stdbool.h>
#include "netsurf/inttypes.h"
#include "netsurf/plot_style.h"
#include "utils/errors.h"
#include "utils/nscolour.h"
#include "desktop/system_colour.h"
Include dependency graph for nscolour.c:

Go to the source code of this file.

Functions

static nserror nscolour__get (const char *name_bg, const char *name_fg, unsigned bg_num, unsigned bg_den, colour *bg, colour *bg_hover, colour *fg, colour *fg_subtle, colour *fg_faded, colour *fg_good, colour *fg_bad, colour *border)
 Set some colours up from a couple of system colour entries. More...
 
nserror nscolour_update (void)
 Update the nscolour table from the current nsoptions. More...
 
nserror nscolour_get_stylesheet (const char **stylesheet_out)
 Get a pointer to a stylesheet for nscolours. More...
 

Variables

colour nscolours [NSCOLOUR__COUNT]
 NetSurf UI colour table. More...
 

Detailed Description

NetSurf UI colours (implementation).

Builds common colours used throughout NetSurf's interface.

Definition in file nscolour.c.

Function Documentation

◆ nscolour__get()

static nserror nscolour__get ( const char *  name_bg,
const char *  name_fg,
unsigned  bg_num,
unsigned  bg_den,
colour bg,
colour bg_hover,
colour fg,
colour fg_subtle,
colour fg_faded,
colour fg_good,
colour fg_bad,
colour border 
)
static

Set some colours up from a couple of system colour entries.

Parameters
[in]name_bgName of choices string for background colour lookup.
[in]name_fgName of choices string for foreground colour lookup.
[in]bg_numNumerator for background adjustment ratio.
[in]bg_denDenominator for backfground adjustment ratio.
[out]bgReturns the background colour.
[out]bg_hoverReturns the hovered background colour.
[out]fgReturns the foreground colour.
[out]fg_subtleReturns the subtle foreground colour.
[out]fg_fadedReturns the faded foreground colour.
[out]fg_goodReturns the good foreground colour.
[out]fg_badReturns the bad foreground colour.
[out]borderReturns the border colour.

Definition at line 56 of file nscolour.c.

References colour_engorge_component(), colour_lightness, half_darken_colour, half_lighten_colour, mix_colour, ns_system_colour_char(), NSERROR_OK, PLOT_COLOUR_COMPONENT_GREEN, and PLOT_COLOUR_COMPONENT_RED.

Referenced by nscolour_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nscolour_get_stylesheet()

nserror nscolour_get_stylesheet ( const char **  stylesheet_out)

Get a pointer to a stylesheet for nscolours.

Returns
NSERROR_OK on success, or appropriate error otherwise.

Definition at line 206 of file nscolour.c.

References buffer, colour_rb_swap, NSCOLOUR_WIN_EVEN_BG, NSCOLOUR_WIN_EVEN_BG_HOVER, NSCOLOUR_WIN_EVEN_BORDER, NSCOLOUR_WIN_EVEN_FG, NSCOLOUR_WIN_EVEN_FG_BAD, NSCOLOUR_WIN_EVEN_FG_FADED, NSCOLOUR_WIN_EVEN_FG_GOOD, NSCOLOUR_WIN_EVEN_FG_SUBTLE, NSCOLOUR_WIN_ODD_BG, NSCOLOUR_WIN_ODD_BG_HOVER, NSCOLOUR_WIN_ODD_FG, NSCOLOUR_WIN_ODD_FG_BAD, NSCOLOUR_WIN_ODD_FG_FADED, NSCOLOUR_WIN_ODD_FG_GOOD, NSCOLOUR_WIN_ODD_FG_SUBTLE, nscolours, NSERROR_NOSPACE, and NSERROR_OK.

Referenced by dirlist_generate_title().

Here is the caller graph for this function:

◆ nscolour_update()

nserror nscolour_update ( void  )

Update the nscolour table from the current nsoptions.

Returns
NSERROR_OK on success, or appropriate error otherwise.

Definition at line 132 of file nscolour.c.

References blend_colour, colour_to_bw_nearest, ns_system_colour_char(), nscolour__get(), NSCOLOUR_BUTTON_BG, NSCOLOUR_BUTTON_FG, NSCOLOUR_SCROLL_WELL, NSCOLOUR_SEL_BG, NSCOLOUR_SEL_FG, NSCOLOUR_SEL_FG_SUBTLE, NSCOLOUR_TEXT_INPUT_BG, NSCOLOUR_TEXT_INPUT_FG, NSCOLOUR_TEXT_INPUT_FG_SUBTLE, NSCOLOUR_WIN_EVEN_BG, NSCOLOUR_WIN_EVEN_BG_HOVER, NSCOLOUR_WIN_EVEN_BORDER, NSCOLOUR_WIN_EVEN_FG, NSCOLOUR_WIN_EVEN_FG_BAD, NSCOLOUR_WIN_EVEN_FG_FADED, NSCOLOUR_WIN_EVEN_FG_GOOD, NSCOLOUR_WIN_EVEN_FG_SUBTLE, NSCOLOUR_WIN_ODD_BG, NSCOLOUR_WIN_ODD_BG_HOVER, NSCOLOUR_WIN_ODD_BORDER, NSCOLOUR_WIN_ODD_FG, NSCOLOUR_WIN_ODD_FG_BAD, NSCOLOUR_WIN_ODD_FG_FADED, NSCOLOUR_WIN_ODD_FG_GOOD, NSCOLOUR_WIN_ODD_FG_SUBTLE, nscolours, and NSERROR_OK.

Referenced by netsurf_init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ nscolours

colour nscolours[NSCOLOUR__COUNT]