21void GfxInitPalettes();
31static constexpr int DEFAULT_BRIGHTNESS = 128;
35static inline Colour AdjustBrightness(Colour colour, uint8_t brightness)
38 if (brightness == DEFAULT_BRIGHTNESS)
return colour;
51 uint8_t rgb_max = std::max(colour.r, std::max(colour.g, colour.b));
54 if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
67 return colours < COLOUR_END;
72enum ColourShade : uint8_t {
74 SHADE_DARKEST = SHADE_BEGIN,
Type (helpers) for enums.
#define DECLARE_INCREMENT_DECREMENT_OPERATORS(enum_type)
For some enums it is useful to have pre/post increment/decrement operators.
Types related to the graphics and/or input devices.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
static uint8_t GetColourBrightness(Colour colour)
Get the brightness of a colour.
static constexpr PixelColour PC_TREES
Green palette colour for trees.
static constexpr PixelColour PC_VERY_DARK_RED
Almost-black red palette colour.
bool CopyPalette(Palette &local_palette, bool force_copy=false)
Copy the current palette if the palette was updated.
static constexpr PixelColour PC_VERY_LIGHT_YELLOW
Almost-white yellow palette colour.
static constexpr PixelColour PC_ROUGH_LAND
Dark green palette colour for rough land.
static constexpr PixelColour PC_YELLOW
Yellow palette colour.
static constexpr PixelColour PC_GREEN
Green palette colour.
static constexpr PixelColour PC_FIELDS
Light brown palette colour for fields.
constexpr PixelColour GREY_SCALE(uint8_t level)
Return the colour for a particular greyscale level.
static constexpr PixelColour PC_DARK_RED
Dark red palette colour.
bool IsValidColours(Colours colours)
Checks if a Colours value is valid.
static constexpr PixelColour PC_WATER
Dark blue palette colour for water.
void SetColourGradient(Colours colour, ColourShade shade, PixelColour palette_colour)
Set colour gradient palette index.
static constexpr PixelColour PC_ORANGE
Orange palette colour.
static constexpr PixelColour PC_GRASS_LAND
Dark green palette colour for grass land.
static constexpr PixelColour PC_DARK_BLUE
Dark blue palette colour.
static constexpr PixelColour PC_BARE_LAND
Brown palette colour for bare land.
Colour ReallyAdjustBrightness(Colour colour, int brightness)
Adjust brightness of colour.
Palette _cur_palette
Current palette.
static constexpr PixelColour PC_GREY
Grey palette colour.
static constexpr PixelColour PC_RED
Red palette colour.
static constexpr PixelColour PC_DARK_GREY
Dark grey palette colour.
uint8_t GetNearestColourReshadeIndex(uint8_t b)
Get nearest colour palette index from a brightness level.
static constexpr PixelColour PC_BLACK
Black palette colour.
TextColour GetContrastColour(PixelColour background, uint8_t threshold=128)
Determine a contrasty text colour for a coloured background.
uint8_t GetNearestColourIndex(uint8_t r, uint8_t g, uint8_t b)
Get nearest colour palette index from an RGB colour.
static constexpr PixelColour PC_LIGHT_YELLOW
Light yellow palette colour.
static constexpr PixelColour PC_RAINFOREST
Pale green palette colour for rainforest.
static constexpr PixelColour PC_WHITE
White palette colour.
PixelColour GetColourGradient(Colours colour, ColourShade shade)
Get colour gradient palette index.
static constexpr PixelColour PC_VERY_DARK_BROWN
Almost-black brown palette colour.
static constexpr PixelColour PC_LIGHT_BLUE
Light blue palette colour.
static constexpr PixelColour PC_VERY_DARK_BLUE
Almost-black blue palette colour.
Types related to strings.
Information about the currently used palette.
Colour for pixel/line drawing.