Freeciv21
Develop your civilization from humble roots to a global empire
colors_common.cpp File Reference
#include "log.h"
#include "shared.h"
#include "player.h"
#include "rgbcolor.h"
#include "terrain.h"
#include "colors_g.h"
#include "tileset/tilespec.h"
#include "colors_common.h"
+ Include dependency graph for colors_common.cpp:

Go to the source code of this file.

Classes

struct  color_system
 

Functions

struct color_systemcolor_system_read (struct section_file *file)
 Called when the client first starts to allocate the default colors. More...
 
void color_system_free (struct color_system *colors)
 Called when the client first starts to free any allocated colors. More...
 
QColor get_color (const struct tileset *t, enum color_std stdcolor)
 Return a pointer to the given "standard" color. More...
 
bool player_has_color (const struct tileset *t, const struct player *pplayer)
 Return whether the player has a color assigned yet. More...
 
QColor get_player_color (const struct tileset *t, const struct player *pplayer)
 Return the color of the player. More...
 
QColor get_terrain_color (const struct tileset *t, const struct terrain *pterrain)
 Return a pointer to the given "terrain" color. More...
 
QColor color_best_contrast (const QColor &subject, const QColor *candidates, int ncandidates)
 Find the colour from 'candidates' with the best perceptual contrast from 'subject'. More...
 
int color_brightness_score (const QColor &color)
 Return a number indicating the perceptual brightness of this color relative to others (larger is brighter). More...
 

Function Documentation

◆ color_best_contrast()

QColor color_best_contrast ( const QColor &  subject,
const QColor *  candidates,
int  ncandidates 
)

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

Definition at line 136 of file colors_common.cpp.

Referenced by diplo_wdg::diplo_wdg(), traditional_citybar_painter::paint(), and polished_citybar_painter::paint().

◆ color_brightness_score()

int color_brightness_score ( const QColor &  color)

Return a number indicating the perceptual brightness of this color relative to others (larger is brighter).

Definition at line 162 of file colors_common.cpp.

Referenced by color_best_contrast().

◆ 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 66 of file colors_common.cpp.

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 40 of file colors_common.cpp.

Referenced by tileset_read_toplevel().

◆ get_color()

◆ get_player_color()

QColor get_player_color ( const struct tileset t,
const struct player pplayer 
)

◆ get_terrain_color()

QColor get_terrain_color ( const struct tileset t,
const struct terrain pterrain 
)

Return a pointer to the given "terrain" color.

Definition at line 122 of file colors_common.cpp.

Referenced by overview_tile_color().

◆ player_has_color()

bool player_has_color ( const struct tileset t,
const struct player pplayer 
)

Return whether the player has a color assigned yet.

Should only be FALSE in pregame.

Definition at line 96 of file colors_common.cpp.

Referenced by freeciv::layer_background::initialize_player(), freeciv::layer_grid::initialize_player(), and page_pregame::update_start_page().