Create the color tables for palette downgrade support,
        starting with the platform-specific 16 from the color tables module.
        Save as global state. :-/

def build_color_tables(base=color_tables.vga_palette4):
    '''
        Create the color tables for palette downgrade support,
        starting with the platform-specific 16 from the color tables module.
        Save as global state. :-/
    '''
    base = [] if base is None else base

    # make sure we have them before clearing
    table4 = _build_color_table(base, extended=False)
    if table4:
        color_table4.clear()
        color_table4.extend(table4)

    table8 = _build_color_table(base)
    if table8:
        color_table8.clear()
        color_table8.extend(table8)