To increase the number of available colours on screen, the Spectrum Next supports palletized colours.
Colour IDs in Layer 2, Tilemap 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 Enhanced ULA 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 and border colors, and 136-143 for BRIGHT paper colors.
Palette configuration can be done through registers $40-$44 and $6B. Enhanced ULA Control Register ($43) sets which palette is being set up. There are two palettes each for Layer 2, Sprites, Tilemap and ULA; which one of the two is used for each is selected using the lower bits of Enhanced ULA Control Register ($43) and in Tilemap Control Register ($6B).
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) or Enhanced ULA Palette Extension ($44) which then auto-increment. $41 is used for sending 8-bit colours in RRRGGGBB format; the "missing" third blue bit is set to an OR between the other two. $44 is used for sending 9-bit colours in two byte packets; the first byte sent should be RRRGGGBB as with $41, and the second byte's LSB fills in the third blue bit. For Layer 2 color the top bit in second byte signals "priority" colour, which makes particular Layer 2 pixel to be drawn on top of everything else, overriding current order of layers.
With Enhanced ULA mode enabled, the Enhanced ULA Ink Color Mask ($42) defines how particular ULA attribute breaks into INK and PAPER color. The INK colors are mapped from index 0 in palette, PAPER (and BORDER) colors are mapped from index 128, except when in "full ink" mode (ink mask = 255), then PAPER and BORDER color is taken from Transparency colour fallback Register ($4A).