WCAG 2 contrast
Contrast ratio uses relative luminance of each sRGB colour. The lighter luminance L1 and darker L2 give (L1 + 0.05) / (L2 + 0.05). Normal-size text needs 4.5:1 for AA and 7:1 for AAA. Large text (18pt or 14pt bold) and UI component graphics need 3:1 for AA.
Formula
L = 0.2126 R + 0.7152 G + 0.0722 B (linearised sRGB)
Contrast = (L_light + 0.05) / (L_dark + 0.05)
Pick a starting colour in Color Studio, then paste the HEX values here. Swapping foreground and background does not change the ratio, but it does change which treatment you are previewing.