>I'm not a graphics designer, just an attempt
This seems like an awesome approach. I did not think of separating the RGB values for calculation. However, there seems to be an adjustment. This provides a HEX color result but not exactly the one I am looking for. Attached, you can see the first image which is the template. That's the one holding the base reference for calculation. That one is the green one. You can see that the Main color and the Table header background color are the two colors I gave. This is representing in your message as the first pair. Then, on the next image, you can see the blue template. You can see that the main color is the first color of the second pair, where we need to calculate the second one. Your formula gives a color geared towards a shade of red. I am looking to obtain a lighter color of blue. In the first image, we can see that the second color is lighter than the main color which is a darker green. So, from the darker blue, we need to obtain a lighter blue. I am looking at your code to see if I can spot something that has to be adjusted. With the explanation I gave, does this still reflect the code you provided or that can help to fine tune the code to help in that direction?