How to calculate the Contrast Ratio

Tell us what’s happening:
Describe your issue in detail here.
I was able to solve this question. But I don’t understand how the values were calculated to get 5.9% Please walk me through that.

“Increase the background-color lightness value from 35% to 55%, and decrease the color lightness value from 20% to 15%. This improves the contrast to 5.9:1.”

  **Your code so far**

body {
  color: hsl(0, 55%, 15%);
  background-color: hsl(120, 25%, 55%);
  <h1>Deep Thoughts with Master Camper Cat</h1>
  <h2>A Word on the Recent Catnip Doping Scandal</h2>
  <p>The influence that catnip has on feline behavior is well-documented, and its use as an herbal supplement in competitive ninja circles remains controversial. Once again, the debate to ban the substance is brought to the public's attention after the high-profile win of Kittytron, a long-time proponent and user of the green stuff, at the Claw of Fury tournament.</p>
  <p>As I've stated in the past, I firmly believe a true ninja's skills must come from within, with no external influences. My own catnip use shall continue as purely recreational.</p>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Avoid Colorblindness Issues by Using Sufficient Contrast

Link to the challenge:

There are a ton of ways to measure a contrast ratio, and I’m not sure which way is used here. In general, there are tools and recommended palates for this sort of thing.