Palettes
To increase the number of available colours on screen, the Spectrum Next supports palletized colours.
Colour IDs in Layer 2 and Sprites are always taken as palette indices. Colour values in the ULA are mapped to the palette as fixed indices, or can be taken as partial palette indices if ULANext mode is enabled. The palette entry numbers for standard ULA mode are: 0-7 for the standard ink colors, 8-15 for BRIGHT ink colors, 128-135 for standard paper colors, and 136-143 for BRIGHT paper colors.
Palette configuration can be done through registers $40-$44. Enhanced ULA Control Register ($43) sets which palette is being set up. There are two palettes each for Layer 2, Sprites, and ULA; which one of the two is used for each is selected using the lower bits of Enhanced ULA Control Register ($43).
Once a palette is selected, Palette Index Register ($40) sets the palette entry number to set up; you can then send the color to set it to on Palette Value Register ($41) and Enhanced ULA Palette Extension ($44) which then auto-increment. $41 sends the main 8 bits of the colour; $44 sends the remaining 1 bit for 9-bit colour (3 bits each for red, green, and blue).