Here’s a script that achieves what you want by setting your Foreground colour to the colour halfway between your Foreground and Background colours.