
How about this:

Non-256 colour modes:

        Font_SetPalette
        In      R0 = font handle / 0
                R1 = background colour
                R2 = foreground colour + top bit set if R3,R4 are 24-bit
                R3 = true background RGB
                R4 = true foreground RGB
        Out     ColourTrans_SetPalette called to set the palette
                If ColourTrans not loaded, PaletteV / OS_Word called instead

256 colour modes:

        Font_SetPalette
        In      R0 = font handle / 0
                R1 = unused
                R2 = pseudo-palette entry number in range 0..15, or -1
                R3 = background RGB
                R4 = foreground RGB
        Out     ColourTrans_ReturnColourNumber called to obtain colours
                If R2=-1 on entry, then:
                     R2 = pseudo-palette entry number in range 16..255
                     current font colours preserved
                else:
                     R2 = preserved, current font colours set to R1,R2
                endif

If R2 = -1 on entry, the Font Manager tries to match the colours with a
buffer already allocated, and if it finds one, returns the colour number of
that buffer, else it creates a new one and returns its handle.

It also treats R3,R4 as 24-bit if R2=-1 on entry, else 12-bit.

Then:

        ColourTrans_ReturnFontColours in 256-colour mode:

                Push    "R1,LR"

                MOV     R3,R1
                MOV     R4,R2
                MOV     R2,#-1
                SWI     XFont_SetPalette
                BVS     try_old_code_for_compatibility

                MOV     R3,#14                          ; treat as anti-aliased


############## aargh!  it doesn't work cos the result might be monochrome  ##################

