Difference between revisions of "NML:List of default colour translation palettes"

From GRFSpecs
Jump to navigationJump to search
(PALETTE_IDENTITY)
 
Line 128: Line 128:
   
 
The base sprite for 2 company colours may vary. Following <code style="color:darkgreen">base_sprite_2cc</code> are the 16x16 colour translations for all possible combinations of a first and second company colour. Their order is defined by the following formula: <code style="color:darkgreen">sprite = base_sprite_2cc + colour1 + 16*colour2</code>, for info on the colour values see below.
 
The base sprite for 2 company colours may vary. Following <code style="color:darkgreen">base_sprite_2cc</code> are the 16x16 colour translations for all possible combinations of a first and second company colour. Their order is defined by the following formula: <code style="color:darkgreen">sprite = base_sprite_2cc + colour1 + 16*colour2</code>, for info on the colour values see below.
  +
  +
  +
The following image represents the colour mappings of the listed palettes:
  +
  +
[[File:Colour_translation_palettes.png]]
  +
  +
The code for <i>recolour sprites</i> themselves can be found in the OpenGFX Github repository:
  +
<ul>
  +
<li>[https://github.com/OpenTTD/OpenGFX/blob/master/sprites/base/base-0771-recolor-gui.pnml base-0771-recolor-gui.pnml]</li>
  +
<li>[https://github.com/OpenTTD/OpenGFX/blob/master/sprites/base/base-0775-recolor.pnml base-0775-recolor.pnml]</li>
  +
<li>[https://github.com/OpenTTD/OpenGFX/blob/master/sprites/base/base-1438-recolor-church.pnml base-1438-recolor-church.pnml]</li>
  +
</ul>
  +
   
 
===Company colour helper functions===
 
===Company colour helper functions===

Latest revision as of 09:55, 22 July 2024

Additional References

You can use the palette name directly. The numeric value is only given for reference and might come in handy when the values are to be used in calculations.

PALETTE_IDENTITY can be used to disable any recolouring.

PALETTE_USE_DEFAULT will prompt usage of the default palette, which differs per feature:

  • For vehicles, it's the 1cc / 2cc colour map in the company's colours.
  • For houses, it's the return value of the colour callback, or a randomly chosen colour from the random_colours property.
  • For industry tiles, the random colour of the industry is used, which may be changed by the colour industry callback.
  • For objects, the colour scheme of the constructing company is used, which may be altered by the colour callback.
  • For rail types, the company colour of the owner is always used for recolouring fences and depots, other sprites cannot be recoloured. Specifying a recolour sprite yourself is not possible.
  • For stations and airport tiles, it's the company colour of the owner.
Palette name value
PALETTE_USE_DEFAULT 0
PALETTE_TILE_RED_PULSATING 771
PALETTE_SEL_TILE_RED 772
PALETTE_SEL_TILE_BLUE 773
PALETTE_IDENTITY 775
PALETTE_CC_FIRST 775
PALETTE_CC_DARK_BLUE 775, # = first
PALETTE_CC_PALE_GREEN 776
PALETTE_CC_PINK 777
PALETTE_CC_YELLOW 778
PALETTE_CC_RED 779
PALETTE_CC_LIGHT_BLUE 780
PALETTE_CC_GREEN 781
PALETTE_CC_DARK_GREEN 782
PALETTE_CC_BLUE 783
PALETTE_CC_CREAM 784
PALETTE_CC_MAUVE 785
PALETTE_CC_PURPLE 786
PALETTE_CC_ORANGE 787
PALETTE_CC_BROWN 788
PALETTE_CC_GREY 789
PALETTE_CC_WHITE 790
PALETTE_BARE_LAND 791
PALETTE_STRUCT_BLUE 795
PALETTE_STRUCT_BROWN 796
PALETTE_STRUCT_WHITE 797
PALETTE_STRUCT_RED 798
PALETTE_STRUCT_GREEN 799
PALETTE_STRUCT_CONCRETE 800
PALETTE_STRUCT_YELLOW 801
PALETTE_TRANSPARENT 802
PALETTE_STRUCT_GREY 803
PALETTE_CRASH 804
PALETTE_CHURCH_RED 1438
PALETTE_CHURCH_CREAM 1439
base_sprite_2cc n/a

The base sprite for 2 company colours may vary. Following base_sprite_2cc are the 16x16 colour translations for all possible combinations of a first and second company colour. Their order is defined by the following formula: sprite = base_sprite_2cc + colour1 + 16*colour2, for info on the colour values see below.


The following image represents the colour mappings of the listed palettes:

Colour translation palettes.png

The code for recolour sprites themselves can be found in the OpenGFX Github repository:


Company colour helper functions

For company colour translations, it may be more convenient to use one of the following helper functions:

palette_1cc(colour)
palette_2cc(colour1, colour2)

Colour values may be taken from the following table. Note that their order corresponds with the order of the 1cc palettes PALETTE_CC_XXX.

Colour name Numerical value
COLOUR_DARK_BLUE 0
COLOUR_PALE_GREEN 1
COLOUR_PINK 2
COLOUR_YELLOW 3
COLOUR_RED 4
COLOUR_LIGHT_BLUE 5
COLOUR_GREEN 6
COLOUR_DARK_GREEN 7
COLOUR_BLUE 8
COLOUR_CREAM 9
COLOUR_MAUVE 10
COLOUR_PURPLE 11
COLOUR_ORANGE 12
COLOUR_BROWN 13
COLOUR_GREY 14
COLOUR_WHITE 15