Generate ranges of colors, and color palettes. More...
#include "color_range.hpp"
#include "game_config.hpp"
#include "map/map.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include <iomanip>
Go to the source code of this file.
Functions | |
std::map< Uint32, Uint32 > | recolor_range (const color_range &new_range, const std::vector< Uint32 > &old_rgb) |
Converts a source palette using the specified color_range object. More... | |
bool | string2rgb (const std::string &s, std::vector< Uint32 > &result) |
std::vector< Uint32 > | palette (color_range cr) |
Creates a reference color palette from a color range. More... | |
std::string | rgb2highlight (Uint32 rgb) |
Converts a color value to WML text markup syntax for highlighting. More... | |
std::string | rgb2highlight_pango (Uint32 rgb) |
Converts a color value to WML text markup syntax for highlighting. More... | |
Generate ranges of colors, and color palettes.
Used e.g. to color HP, XP.
Definition in file color_range.cpp.
std::vector<Uint32> palette | ( | color_range | cr | ) |
Creates a reference color palette from a color range.
Definition at line 130 of file color_range.cpp.
References c, i, and recolor_range().
Referenced by game_config::add_color_info().
std::map<Uint32, Uint32> recolor_range | ( | const color_range & | new_rgb, |
const std::vector< Uint32 > & | old_rgb | ||
) |
Converts a source palette using the specified color_range object.
This holds the main interface for range-based team coloring. The output is used with the recolor_image() method to do the actual recoloring.
new_rgb | Specifies parameters for the conversion. |
old_rgb | Source palette. |
Definition at line 30 of file color_range.cpp.
References color_range::max(), color_range::mid(), and color_range::min().
Referenced by BOOST_AUTO_TEST_CASE(), and palette().
std::string rgb2highlight | ( | Uint32 | rgb | ) |
Converts a color value to WML text markup syntax for highlighting.
For example, 0x00CC00CC becomes "<204,0,204>".
Definition at line 158 of file color_range.cpp.
References h.
Referenced by mp::get_color_string(), and team::get_side_highlight().
std::string rgb2highlight_pango | ( | Uint32 | rgb | ) |
Converts a color value to WML text markup syntax for highlighting.
For example, 0x00CC00CC becomes "#CC00CC".
Definition at line 168 of file color_range.cpp.
References h.
Referenced by team::get_side_highlight_pango().
bool string2rgb | ( | const std::string & | s, |
std::vector< Uint32 > & | result | ||
) |
Definition at line 91 of file color_range.cpp.
References c, lexical_cast(), and utils::split().
Referenced by game_config::add_color_info(), game_config::color_info(), game_config::load_config(), string_to_color(), and game_config::tc_info().