I think I've solved the random colour problem.
In NFO:https://newgrf-specs.tt-wiki.net/wiki/A ... ng_sprites
House action2/sprite layout, under sprite definition for ground and building sprites, says:
Bits 14-15: 0: draw sprite normally, 1: draw sprite in transparent mode, 2: recolor sprite
Bits 16-29: Colour translation special sprite number
If bits 16-29 are set then it just uses that recolouring. If they are not set then, if house callback 1E is returns a value, that palette/colour translation will be used. Otherwise if colours are specified in house action0 property 17 then they will be used.
In NML:https://newgrf-specs.tt-wiki.net/wiki/N ... ecolouring
Setting a recolour_mode in a spritelayout is presumably equivalent to action2/sprite layout bits 14-15. Similarly setting the palette in a spritelayout is presumably setting bits 16-29.
Not setting a palette (i.e. ommitting the line) is not allowed:
"nmlc ERROR: 'palette' must be set when 'recolour_mode' is not set to RECOLOUR_NONE"
However, setting palette to 0 (i.e. trying to imitate setting bits 16-29 to zero) works.
It looks like an over-stringency in nmlc; if recolour_mode is not set to RECOLOUR_NONE then palette should probably default to zero.