def add_color_to_scheme(scheme, name, foreground, background, palette_colors):
if foreground is None and background is None:<EOL><INDENT>return scheme<EOL><DEDENT>new_scheme = []<EOL>for item in scheme:<EOL><INDENT>if item[<NUM_LIT:0>] == name:<EOL><INDENT>if foreground is None:<EOL><INDENT>foreground = item[<NUM_LIT:1>]<EOL><DEDENT>if background is None:<EOL><INDENT>background = item[<NUM_LIT:2>]<EOL><DEDENT>if palette_colors > <NUM_LIT:16>:<EOL><INDENT>new_scheme.append((name, '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', foreground, background))<EOL><DEDENT>else:<EOL><INDENT>new_scheme.append((name, foreground, background))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>new_scheme.append(item)<EOL><DEDENT><DEDENT>return new_scheme<EOL>
Add foreground and background colours to a color scheme