Updated patch foreground color code to use patch text color calculations (and also use new luminance calculation)