I have been doing some additional reading and it appears that the answer is that the link text needs to have a 3:1 contrast ratio to surrounding text.
So you can, for example, use the Juicy Luminosity Colour Contrast Ratio Analyser to measure the contrast of the link text and non-link text color to see if their contrast is greater than 3:1.
You can then use the contrast ratio analyzer to determine whether both colors ALSO contrast with the background enough.
G183: Using a contrast ratio of 3:1 with surrounding text and providing additional visual cues on focus for links or controls where color alone is used to identify them
With this technique, a relative luminance (lightness) difference of 3:1 or greater with the text around it can be used if additional visual confirmation is available when a user points or tabs to the link. Visual highlights may, for example, take the form of underline, a change in font style such as bold or italics, or an increase in font size.
While using this technique is sufficient to meet this success criteria, it is not the preferred technique to differentiate link text. This is because links that use the relative luminance of color alone may not be obvious to people with black/white color blindness. If there are not a large number of links in the block of text, underlines are recommended for links.
The link below has an example of what this would look like to people with different types color blindness. They also give you 26 colors that work on both a pure white and a pure black background.
Any other color background, you would need to use the iterative testing idea I posted above.
Links with a 3:1 contrast ratio with surrounding text - These 26 web-safe colors pass at 3:1 vs black and 5:1 vs. white
As far as a tool goes, all one would need to do is to calculate the contrast ratio of link text to non-link text plus the contrast of both colors on a third background color and if all three pass the limits defined in the various resources on this page, then I think you'd have the magic box I was looking for.