Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Functions
colors_common.c File Reference
#include "log.h"
#include "shared.h"
#include "player.h"
#include "rgbcolor.h"
#include "colors_g.h"
#include "tilespec.h"
#include "colors_common.h"

Go to the source code of this file.

Data Structures

struct  color_system
 

Functions

struct color_systemcolor_system_read (struct section_file *file)
 
void color_system_free (struct color_system *colors)
 
struct colorensure_color (struct rgbcolor *rgb)
 
struct colorget_color (const struct tileset *t, enum color_std stdcolor)
 
bool player_has_color (const struct player *pplayer)
 
struct colorget_player_color (const struct tileset *t, const struct player *pplayer)
 
struct colorget_terrain_color (const struct tileset *t, const struct terrain *pterrain)
 
struct colorcolor_best_contrast (struct color *subject, struct color **candidates, int ncandidates)
 

Function Documentation

◆ color_best_contrast()

struct color * color_best_contrast ( struct color subject,
struct color **  candidates,
int  ncandidates 
)

Find the colour from 'candidates' with the best perceptual contrast from 'subject'.

Definition at line 150 of file colors_common.c.

Referenced by diplo_wdg::diplo_wdg(), and show_full_citybar().

◆ color_system_free()

void color_system_free ( struct color_system colors)

Called when the client first starts to free any allocated colors.

Definition at line 70 of file colors_common.c.

Referenced by tileset_free_toplevel().

◆ color_system_read()

struct color_system * color_system_read ( struct section_file file)

Called when the client first starts to allocate the default colors.

Currently this must be called in ui_main, generally after UI initialization.

Definition at line 44 of file colors_common.c.

Referenced by tileset_read_toplevel().

◆ ensure_color()

struct color * ensure_color ( struct rgbcolor rgb)

Return the RGB color, allocating it if necessary.

Definition at line 87 of file colors_common.c.

Referenced by get_color(), get_player_color(), get_terrain_color(), and tileset_background_init().

◆ get_color()

struct color * get_color ( const struct tileset t,
enum color_std  stdcolor 
)

◆ get_player_color()

struct color * get_player_color ( const struct tileset t,
const struct player pplayer 
)

Return the color of the player. In pregame, callers should check player_has_color() before calling this.

Definition at line 125 of file colors_common.c.

Referenced by create_player_icon(), plr_item::data(), diplo_wdg::diplo_wdg(), overview_tile_color(), popup_find_dialog(), show_full_citybar(), tileset_player_init(), update_goto_dialog(), and fc_client::update_start_page().

◆ get_terrain_color()

struct color * get_terrain_color ( const struct tileset t,
const struct terrain pterrain 
)

Return a pointer to the given "terrain" color.

Definition at line 137 of file colors_common.c.

Referenced by overview_tile_color().

◆ player_has_color()

bool player_has_color ( const struct player pplayer)

Return whether the player has a color assigned yet. Should only be FALSE in pregame.

Definition at line 113 of file colors_common.c.

Referenced by create_player_icon(), tileset_player_init(), and fc_client::update_start_page().