The ZX Spectrum has three RGB sets: border, ink and paper, one of which must be routed to the RGB output depending on whether we're generating the border, a forground pixel or background (non-pixel).
So we have one set of three colours to select from three sets of three. This can easily be achieved through the use of 2-to-1 line multiplexers. One multiplexer can select between ink and paper colour and feed its output into another multiplexer, which selects between that and the border colour. This will be done for the Red, Green and Blue signals.
I've got some concerns about cascading multiplexers in this way because of the propagation delay that is incurred between switching ink/paper colours and the border switch. This will only be in the order of 18ns but may be visible on the display, and given that there are larger multiplexers available we could avoid cascading altogether.
Here is the same implementation using 4-to-1 line multiplexers.
I've deliberately used devices with Enable inputs to allow the output to be unhooked during the blank phase.