Yes, but I don't recommend doing so in CMYK. For meaningful results, you want to use a perceptually uniform model, or at least something close to that. CIELAB is one example, and probably the most accessible, as it is available in Photoshop.
Color perception, and particularly the perceived distance between two colors, is extremely dependent on context. The surrounding colors on the page, the ambient illumination, and the size of the stimuli in other words the text or the graphical element, all significantly effect the perception.
If you are talking about the contrast needed for readability, that is primarily related to luminance or lightness contrast. For good readability, we need significant luminance contrast between the text in the background. And this is most especially true at very high spatial frequencies, meaning small thin text.
CIELAB gives useful information regarding color differences for low spatial frequencies, in other words large patches of color. For high spatial frequencies, in other words small thin text or thin lines, there are some other options for determining ideal lightness contrasts.
Readability Contrast Metrics
- APCA (Accessible Perceptual Contrast Algorithm)—a polarity aware method, weighted for use with self-illuminated monitors.
- DeltaPhiStar—a general purpose contrast algorithm for text, designed to work with the
L* of CIELAB.
- With 𝜟𝜱✴︎, input the BG and Text
L* (Lstar) value:
dpsContrast = (Math.abs(bgLstar ** 1.618 - txLstar ** 1.618) ** 0.618) * 1.414 - 40 ;
// In JS, ** is exponentiation, so x ** y is equiv to Math.pow(x, y)
That will provide the basic lightness (luminance) contrast value for text.
For finding the hue/chroma that has a similar relationship to the original color pair, you might want to use either the CELAB polar coordinates (LChab, or the OKLAB polar coordinates version. In the polar-coordinates versions, hue is defined as an angle 0°-360°.
However, for CIELAB in particular, the hue circle is not exactly "perceptually uniform". CIECAM02 or CAM16 may give you better results there. However, I am not aware of many tools using these more modern models.
You might also want to look at the Munsell system, and/or the Swedish NCS.
The HSB, HSV, HSL methods are NOT perceptually uniform, and if using those, your results may lack consistency.
I created APCA as well as DeltaPhiStar (DPScontrast) and the versions linked to are open source. You might also like to read my article "The Realities and Myths of Contrast and Color" which is written for designers/content authors.