def METHOD_NAME(lut: List[int], filename: Path):
    """
    Writes NES color mapping as a C-array rgb_to_nes
    :param lut: Lookup table of 64 values, indexed as BBGGRR
    :param filename: Source text file to write
    """
    with open(filename, 'wt') as f:
        print('// File auto-generated file by nespal.py', file=f)
        print(f'unsigned char rgb_to_nes[{len(lut)}] = {{', file=f)
        for i, c in enumerate(lut):
            r = ((i >> 0) & 0x3)
            g = ((i >> 2) & 0x3)
            b = ((i >> 4) & 0x3)
            print(f'    0x{c:0{2}X},   // RGB({r},{g},{b}) -> {c:0{2}X}   ({get_ppu_color_name(c)})', file=f)
        print(f'}};', file=f)