Reposted by Martin Wilkes
{prismatic} has a `best_contrast()` function that should do the trick emilhvitfeldt.github.io/prismatic/re...
emilhvitfeldt.github.io
Find highest contrast color — best_contrast
best_contrast() finds the color in y with the highest contrast to the
color x.