It's calculating whether to make it black or white from the context which is the background.